调整 iam
This commit is contained in:
@@ -13,6 +13,8 @@
|
|||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||||
<meta name="format-detection" content="telephone=no" />
|
<meta name="format-detection" content="telephone=no" />
|
||||||
|
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
||||||
|
<meta http-equiv="Pragma" content="no-cache" />
|
||||||
<link rel="stylesheet" href="/iconfont/index.css" />
|
<link rel="stylesheet" href="/iconfont/index.css" />
|
||||||
<link rel="stylesheet" href="/iconfont/avue/iconfont.css" />
|
<link rel="stylesheet" href="/iconfont/avue/iconfont.css" />
|
||||||
<link rel="stylesheet" href="/iconfont/saber/iconfont.css" />
|
<link rel="stylesheet" href="/iconfont/saber/iconfont.css" />
|
||||||
|
|||||||
@@ -79,6 +79,15 @@ export const cancel = id =>
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const start = id =>
|
||||||
|
request({
|
||||||
|
url: `${baseUrl}/start`,
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const complete = id =>
|
export const complete = id =>
|
||||||
request({
|
request({
|
||||||
url: `${baseUrl}/complete`,
|
url: `${baseUrl}/complete`,
|
||||||
|
|||||||
@@ -31,6 +31,13 @@ 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',
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
FROM nginx
|
FROM nginx
|
||||||
VOLUME /tmp
|
VOLUME /tmp
|
||||||
ENV LANG en_US.UTF-8
|
ENV LANG en_US.UTF-8
|
||||||
|
ADD ./src/docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
ADD ./dist/ /usr/share/nginx/html/
|
ADD ./dist/ /usr/share/nginx/html/
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
EXPOSE 443
|
EXPOSE 443
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
import store from './store';
|
import store from './store';
|
||||||
|
import { isChunkLoadError, reloadForChunkError } from './utils/chunk-reload';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install: app => {
|
install: app => {
|
||||||
app.config.errorHandler = (err, vm, info) => {
|
app.config.errorHandler = (err, vm, info) => {
|
||||||
|
if (isChunkLoadError(err) && reloadForChunkError()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
store.commit('ADD_LOGS', {
|
store.commit('ADD_LOGS', {
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: err.message,
|
message: err.message,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
|
import { installChunkReload } from './utils/chunk-reload';
|
||||||
import website from './config/website';
|
import website from './config/website';
|
||||||
import axios from './axios';
|
import axios from './axios';
|
||||||
import router from './router/';
|
import router from './router/';
|
||||||
@@ -46,6 +47,7 @@ import sectionCard from './components/section-card/main.vue';
|
|||||||
import mapSearchResults from './components/map-search-results/main.vue';
|
import mapSearchResults from './components/map-search-results/main.vue';
|
||||||
|
|
||||||
window.$crudCommon = crudCommon;
|
window.$crudCommon = crudCommon;
|
||||||
|
installChunkReload();
|
||||||
debug();
|
debug();
|
||||||
window.axios = axios;
|
window.axios = axios;
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ export const config = {
|
|||||||
'templateType',
|
'templateType',
|
||||||
'transportType',
|
'transportType',
|
||||||
'createUserName',
|
'createUserName',
|
||||||
'remark',
|
|
||||||
'updateTime',
|
'updateTime',
|
||||||
|
'remark',
|
||||||
'createTime',
|
'createTime',
|
||||||
],
|
],
|
||||||
exportColumns: [
|
exportColumns: [
|
||||||
@@ -65,8 +65,8 @@ export const config = {
|
|||||||
{ prop: 'templateType', label: '模板类型' },
|
{ prop: 'templateType', label: '模板类型' },
|
||||||
{ prop: 'transportType', label: '运输方式' },
|
{ prop: 'transportType', label: '运输方式' },
|
||||||
{ prop: 'createUserName', label: '创建人' },
|
{ prop: 'createUserName', label: '创建人' },
|
||||||
{ prop: 'remark', label: '备注' },
|
|
||||||
{ prop: 'updateTime', label: '更新时间' },
|
{ prop: 'updateTime', label: '更新时间' },
|
||||||
|
{ prop: 'remark', label: '备注' },
|
||||||
{ prop: 'createTime', label: '创建时间' },
|
{ prop: 'createTime', label: '创建时间' },
|
||||||
],
|
],
|
||||||
enableAllDept: false,
|
enableAllDept: false,
|
||||||
@@ -82,12 +82,14 @@ export const config = {
|
|||||||
detailAttachmentDescriptionPlain: true,
|
detailAttachmentDescriptionPlain: true,
|
||||||
enableTransportPlanForm: true,
|
enableTransportPlanForm: true,
|
||||||
enableShippingTemplateFreight: true,
|
enableShippingTemplateFreight: true,
|
||||||
editableRoadAddress: true,
|
editableRoadAddress: false,
|
||||||
fixedTransportAddressType: true,
|
fixedTransportAddressType: true,
|
||||||
enableTemplateCodePreview: true,
|
enableTemplateCodePreview: true,
|
||||||
attachmentTitle: '附件',
|
attachmentTitle: '附件',
|
||||||
defaultForm: {
|
defaultForm: {
|
||||||
templateType: '运输计划',
|
templateType: '运输计划',
|
||||||
|
transportType: '公路运输',
|
||||||
|
transportTypeName: '公路运输',
|
||||||
},
|
},
|
||||||
transportFormRequiredFields: [
|
transportFormRequiredFields: [
|
||||||
['projectName', '项目'],
|
['projectName', '项目'],
|
||||||
@@ -119,15 +121,16 @@ export const option = {
|
|||||||
labelWidth: 0,
|
labelWidth: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '模板编号',
|
label: '模板类型',
|
||||||
prop: 'templateCode',
|
prop: 'templateType',
|
||||||
|
type: 'select',
|
||||||
search: true,
|
search: true,
|
||||||
searchOrder: 4,
|
searchOrder: 2,
|
||||||
span: 8,
|
span: 8,
|
||||||
order: 390,
|
order: 390,
|
||||||
minWidth: 170,
|
dicData: templateTypeOptions,
|
||||||
disabled: true,
|
minWidth: 120,
|
||||||
placeholder: '系统自动生成',
|
rules: selectRule('模板类型'),
|
||||||
display: true,
|
display: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -142,16 +145,15 @@ export const option = {
|
|||||||
display: true,
|
display: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '模板类型',
|
label: '模板编号',
|
||||||
prop: 'templateType',
|
prop: 'templateCode',
|
||||||
type: 'select',
|
|
||||||
search: true,
|
search: true,
|
||||||
searchOrder: 2,
|
searchOrder: 4,
|
||||||
span: 8,
|
span: 8,
|
||||||
order: 370,
|
order: 370,
|
||||||
dicData: templateTypeOptions,
|
minWidth: 170,
|
||||||
minWidth: 120,
|
disabled: true,
|
||||||
rules: selectRule('模板类型'),
|
placeholder: '系统自动生成',
|
||||||
display: true,
|
display: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -209,12 +209,12 @@ export const config = {
|
|||||||
attachmentTitle: '附件',
|
attachmentTitle: '附件',
|
||||||
searchRangeMap: {
|
searchRangeMap: {
|
||||||
planStartDateRange: ['planStartDateStart', 'planStartDateEnd'],
|
planStartDateRange: ['planStartDateStart', 'planStartDateEnd'],
|
||||||
planEndDateRange: ['planEndDateStart', 'planEndDateEnd'],
|
createTimeRange: ['createTimeStart', 'createTimeEnd', '00:00:00', '23:59:59'],
|
||||||
},
|
},
|
||||||
actions: ['copy', 'complete'],
|
actions: ['copy', 'complete'],
|
||||||
statusProp: 'businessStatus',
|
statusProp: 'businessStatus',
|
||||||
statusTextProp: 'businessStatusName',
|
statusTextProp: 'businessStatusName',
|
||||||
deleteStatus: ['draft', 'waiting_dispatch'],
|
deleteStatus: ['draft'],
|
||||||
editStatus: ['draft', 'waiting_dispatch', 'dispatching'],
|
editStatus: ['draft', 'waiting_dispatch', 'dispatching'],
|
||||||
detailButton: true,
|
detailButton: true,
|
||||||
detailSections: [
|
detailSections: [
|
||||||
@@ -341,6 +341,7 @@ export const option = {
|
|||||||
{
|
{
|
||||||
label: '发货地址',
|
label: '发货地址',
|
||||||
prop: 'departureAddress',
|
prop: 'departureAddress',
|
||||||
|
slot: true,
|
||||||
formslot: true,
|
formslot: true,
|
||||||
search: true,
|
search: true,
|
||||||
searchOrder: 7,
|
searchOrder: 7,
|
||||||
@@ -352,6 +353,7 @@ export const option = {
|
|||||||
{
|
{
|
||||||
label: '到货地址',
|
label: '到货地址',
|
||||||
prop: 'arrivalAddress',
|
prop: 'arrivalAddress',
|
||||||
|
slot: true,
|
||||||
formslot: true,
|
formslot: true,
|
||||||
search: true,
|
search: true,
|
||||||
searchOrder: 6,
|
searchOrder: 6,
|
||||||
@@ -577,8 +579,8 @@ export const option = {
|
|||||||
viewDisplay: false,
|
viewDisplay: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '计划结束日期',
|
label: '创建时间',
|
||||||
prop: 'planEndDateRange',
|
prop: 'createTimeRange',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
format: 'YYYY-MM-DD',
|
format: 'YYYY-MM-DD',
|
||||||
valueFormat: 'YYYY-MM-DD',
|
valueFormat: 'YYYY-MM-DD',
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-view #="{ Component }">
|
<router-view #="{ Component }">
|
||||||
<keep-alive :include="$store.getters.tagsKeep">
|
<keep-alive :include="$store.getters.tagsKeep">
|
||||||
<component :is="Component" />
|
<component :is="tabView($route, Component)" />
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
</router-view>
|
</router-view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { tabView } from '@/router/tab';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'layout',
|
||||||
|
methods: {
|
||||||
|
tabView,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|||||||
+13
-10
@@ -3,6 +3,8 @@ import store from './store';
|
|||||||
import { tabKeyOf } from '@/router/tab';
|
import { tabKeyOf } from '@/router/tab';
|
||||||
import { getToken } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
import {
|
import {
|
||||||
|
consumeReloadQuery,
|
||||||
|
hasReloadQuery,
|
||||||
isChunkLoadError,
|
isChunkLoadError,
|
||||||
reloadForChunkError,
|
reloadForChunkError,
|
||||||
setPendingRoutePath,
|
setPendingRoutePath,
|
||||||
@@ -17,19 +19,20 @@ const lockPage = '/lock'; //锁屏页
|
|||||||
router.onError(error => {
|
router.onError(error => {
|
||||||
if (!isChunkLoadError(error)) return;
|
if (!isChunkLoadError(error)) return;
|
||||||
if (reloadForChunkError()) {
|
if (reloadForChunkError()) {
|
||||||
ElMessage.warning('页面资源加载失败,正在重新加载…');
|
ElMessage.warning('页面资源已更新,正在重新加载…');
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener('unhandledrejection', event => {
|
|
||||||
if (!isChunkLoadError(event.reason)) return;
|
|
||||||
if (reloadForChunkError()) {
|
|
||||||
event.preventDefault();
|
|
||||||
ElMessage.warning('页面资源加载失败,正在重新加载…');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
|
if (hasReloadQuery(to.query)) {
|
||||||
|
next({
|
||||||
|
path: to.path,
|
||||||
|
query: consumeReloadQuery(to.query),
|
||||||
|
hash: to.hash,
|
||||||
|
replace: true,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
setPendingRoutePath(to.fullPath);
|
setPendingRoutePath(to.fullPath);
|
||||||
const meta = to.meta || {};
|
const meta = to.meta || {};
|
||||||
const isMenu = meta.menu === undefined ? to.query.menu : meta.menu;
|
const isMenu = meta.menu === undefined ? to.query.menu : meta.menu;
|
||||||
@@ -59,7 +62,7 @@ router.beforeEach((to, from, next) => {
|
|||||||
fullPath: tabKeyOf(to),
|
fullPath: tabKeyOf(to),
|
||||||
params: to.params,
|
params: to.params,
|
||||||
query: to.query,
|
query: to.query,
|
||||||
meta: meta,
|
meta: { ...meta, keepAlive: true },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ 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 跨层级缓存
|
||||||
@@ -96,21 +97,23 @@ RouterPlugin.install = function (option = {}) {
|
|||||||
component: (() => {
|
component: (() => {
|
||||||
// 判断是否为首路由
|
// 判断是否为首路由
|
||||||
if (first) {
|
if (first) {
|
||||||
return modules[
|
return wrapViewLoader(
|
||||||
|
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 modules['../page/index/layout.vue'];
|
return wrapViewLoader(modules['../page/index/layout.vue']);
|
||||||
// 判断是否为最终的页面视图
|
// 判断是否为最终的页面视图
|
||||||
} else {
|
} else {
|
||||||
let result = modules[`../${component}.vue`];
|
let result = modules[`../${component}.vue`];
|
||||||
if (!result) {
|
if (!result) {
|
||||||
isComponent = false;
|
isComponent = false;
|
||||||
}
|
}
|
||||||
return result;
|
return wrapViewLoader(result);
|
||||||
}
|
}
|
||||||
})(),
|
})(),
|
||||||
name,
|
name,
|
||||||
@@ -127,7 +130,7 @@ RouterPlugin.install = function (option = {}) {
|
|||||||
if (first) {
|
if (first) {
|
||||||
oMenu[propsDefault.path] = `${path}`;
|
oMenu[propsDefault.path] = `${path}`;
|
||||||
let componentPath = oMenu.component || component;
|
let componentPath = oMenu.component || component;
|
||||||
let result = modules[`../${componentPath}.vue`];
|
let result = wrapViewLoader(modules[`../${componentPath}.vue`]);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
isComponent = false;
|
isComponent = false;
|
||||||
}
|
}
|
||||||
@@ -173,7 +176,7 @@ export const formatPath = (ele, first) => {
|
|||||||
const icon = ele[propsDefault.icon];
|
const icon = ele[propsDefault.icon];
|
||||||
ele[propsDefault.icon] = icon || '';
|
ele[propsDefault.icon] = icon || '';
|
||||||
ele.meta = {
|
ele.meta = {
|
||||||
keepAlive: ele.isOpen === 2,
|
keepAlive: true,
|
||||||
};
|
};
|
||||||
const iframeComponent = 'components/iframe/main';
|
const iframeComponent = 'components/iframe/main';
|
||||||
const iframeSrc = href => {
|
const iframeSrc = href => {
|
||||||
@@ -215,7 +218,7 @@ export const formatPath = (ele, first) => {
|
|||||||
ele[propsDefault.children].forEach(child => {
|
ele[propsDefault.children].forEach(child => {
|
||||||
child.component = 'views' + child[propsDefault.path];
|
child.component = 'views' + child[propsDefault.path];
|
||||||
child.meta = {
|
child.meta = {
|
||||||
keepAlive: child.isOpen === 2,
|
keepAlive: true,
|
||||||
};
|
};
|
||||||
if (isURL(child[propsDefault.href])) {
|
if (isURL(child[propsDefault.href])) {
|
||||||
let href = child[propsDefault.href];
|
let href = child[propsDefault.href];
|
||||||
|
|||||||
+1
-1
@@ -128,5 +128,5 @@ export function tabView(route, Component) {
|
|||||||
};
|
};
|
||||||
wrapperMap.set(tabKey, wrapper);
|
wrapperMap.set(tabKey, wrapper);
|
||||||
}
|
}
|
||||||
return h(wrapper);
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,8 @@ const getters = {
|
|||||||
lockPasswd: state => state.common.lockPasswd,
|
lockPasswd: state => state.common.lockPasswd,
|
||||||
tagList: state => state.tags.tagList,
|
tagList: state => state.tags.tagList,
|
||||||
tagsKeep: (state, getters) => {
|
tagsKeep: (state, getters) => {
|
||||||
return getters.tagList
|
// 所有已打开标签均纳入 keep-alive,关闭标签后自动从白名单移除并释放实例
|
||||||
.filter(ele => {
|
return getters.tagList.map(ele => ele.fullPath).filter(Boolean);
|
||||||
return (ele.meta || {}).keepAlive;
|
|
||||||
})
|
|
||||||
.map(ele => ele.fullPath);
|
|
||||||
},
|
},
|
||||||
tagWel: state => state.tags.tagWel,
|
tagWel: state => state.tags.tagWel,
|
||||||
token: state => state.user.token,
|
token: state => state.user.token,
|
||||||
|
|||||||
+137
-7
@@ -1,38 +1,168 @@
|
|||||||
/**
|
/**
|
||||||
* 懒加载 chunk / CSS preload 失败后的整页恢复。
|
* 懒加载 chunk / CSS preload 失败后的整页恢复。
|
||||||
* 常见于:部署后旧 hash 失效、静态服务空闲断连、代理 CONNECTION_RESET。
|
* 常见于:部署后旧 hash 失效、静态服务空闲断连、代理 CONNECTION_RESET。
|
||||||
|
*
|
||||||
|
* 失败后必须整页刷新:旧入口里的 hashed 资源地址不会自行更新,
|
||||||
|
* 仅捕获路由错误而不刷新时,未打开过的页面会一直无法进入。
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const RELOAD_FLAG = 'app:chunk-reload-ts';
|
const RELOAD_FLAG = 'app:chunk-reload-ts';
|
||||||
const RELOAD_COOLDOWN_MS = 10000;
|
const RELOAD_QUERY = '_chunkreload';
|
||||||
|
const RELOAD_COOLDOWN_MS = 15000;
|
||||||
|
|
||||||
const CHUNK_ERROR_RE =
|
const CHUNK_ERROR_RE =
|
||||||
/Failed to fetch dynamically imported module|Importing a module script failed|Unable to preload CSS|error loading dynamically imported module|Loading CSS chunk|Loading chunk .+ failed|ChunkLoadError/i;
|
/Failed to fetch dynamically imported module|Importing a module script failed|Unable to preload CSS|error loading dynamically imported module|Loading CSS chunk|Loading chunk .+ failed|ChunkLoadError|Unable to preload|error loading module|Load failed/i;
|
||||||
|
|
||||||
/** 最近一次路由跳转目标,供 onError 时整页落到正确地址 */
|
/** 最近一次路由跳转目标,供 onError 时整页落到正确地址 */
|
||||||
let pendingFullPath = '';
|
let pendingFullPath = '';
|
||||||
|
let installed = false;
|
||||||
|
let reloading = false;
|
||||||
|
|
||||||
export function setPendingRoutePath(fullPath = '') {
|
export function setPendingRoutePath(fullPath = '') {
|
||||||
pendingFullPath = fullPath || '';
|
pendingFullPath = fullPath || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function collectErrorText(error, depth = 0) {
|
||||||
|
if (!error || depth > 3) return '';
|
||||||
|
if (typeof error === 'string') return error;
|
||||||
|
const parts = [
|
||||||
|
error.message,
|
||||||
|
error.msg,
|
||||||
|
error.name,
|
||||||
|
error.stack,
|
||||||
|
error.error && collectErrorText(error.error, depth + 1),
|
||||||
|
error.reason && collectErrorText(error.reason, depth + 1),
|
||||||
|
error.cause && collectErrorText(error.cause, depth + 1),
|
||||||
|
error.payload && collectErrorText(error.payload, depth + 1),
|
||||||
|
];
|
||||||
|
const target = error.target;
|
||||||
|
if (target && (target.src || target.href)) {
|
||||||
|
parts.push(target.src || target.href);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
parts.push(String(error));
|
||||||
|
} catch (e) {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
return parts.filter(Boolean).join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
export function isChunkLoadError(error) {
|
export function isChunkLoadError(error) {
|
||||||
if (!error) return false;
|
const text = collectErrorText(error);
|
||||||
const message = error.message || String(error);
|
if (!text) return false;
|
||||||
return CHUNK_ERROR_RE.test(message);
|
if (CHUNK_ERROR_RE.test(text)) return true;
|
||||||
|
return /Failed to fetch/i.test(text) && /\.m?js(\?|$|:)/i.test(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function hasReloadQuery(query = {}) {
|
||||||
|
return !!(query && query[RELOAD_QUERY] !== undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function consumeReloadQuery(query = {}) {
|
||||||
|
if (!hasReloadQuery(query)) return query;
|
||||||
|
const next = { ...query };
|
||||||
|
delete next[RELOAD_QUERY];
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildReloadUrl(targetPath) {
|
||||||
|
const url = new URL(targetPath, window.location.origin);
|
||||||
|
url.searchParams.set(RELOAD_QUERY, String(Date.now()));
|
||||||
|
return url.pathname + url.search + url.hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {boolean} 是否已触发刷新(冷却期内返回 false,避免死循环)
|
* @returns {boolean} 是否已触发刷新(冷却期内返回 false,避免死循环)
|
||||||
*/
|
*/
|
||||||
export function reloadForChunkError(targetPath) {
|
export function reloadForChunkError(targetPath) {
|
||||||
|
if (reloading) return false;
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const last = Number(sessionStorage.getItem(RELOAD_FLAG) || 0);
|
const last = Number(sessionStorage.getItem(RELOAD_FLAG) || 0);
|
||||||
if (now - last < RELOAD_COOLDOWN_MS) {
|
if (now - last < RELOAD_COOLDOWN_MS) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
reloading = true;
|
||||||
sessionStorage.setItem(RELOAD_FLAG, String(now));
|
sessionStorage.setItem(RELOAD_FLAG, String(now));
|
||||||
const path = targetPath || pendingFullPath || window.location.pathname + window.location.search + window.location.hash;
|
const path =
|
||||||
window.location.assign(path);
|
targetPath ||
|
||||||
|
pendingFullPath ||
|
||||||
|
`${window.location.pathname}${window.location.search}${window.location.hash}`;
|
||||||
|
const dest = buildReloadUrl(path);
|
||||||
|
// cache: 'reload' 会回写 HTTP 缓存,降低 index.html 仍指向旧 hash 资源的概率
|
||||||
|
fetch(`${window.location.pathname}?${RELOAD_QUERY}=${now}`, {
|
||||||
|
cache: 'reload',
|
||||||
|
credentials: 'same-origin',
|
||||||
|
headers: {
|
||||||
|
Pragma: 'no-cache',
|
||||||
|
'Cache-Control': 'no-cache',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.catch(() => {})
|
||||||
|
.finally(() => {
|
||||||
|
window.location.replace(dest);
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function wrapViewLoader(loader) {
|
||||||
|
if (typeof loader !== 'function') return loader;
|
||||||
|
return () =>
|
||||||
|
Promise.resolve()
|
||||||
|
.then(() => loader())
|
||||||
|
.catch(error => {
|
||||||
|
if (isChunkLoadError(error)) {
|
||||||
|
reloadForChunkError();
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function installChunkReload() {
|
||||||
|
if (installed || typeof window === 'undefined') return;
|
||||||
|
installed = true;
|
||||||
|
|
||||||
|
window.addEventListener('vite:preloadError', event => {
|
||||||
|
if (reloadForChunkError()) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('unhandledrejection', event => {
|
||||||
|
if (!isChunkLoadError(event.reason)) return;
|
||||||
|
if (reloadForChunkError()) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener(
|
||||||
|
'error',
|
||||||
|
event => {
|
||||||
|
const el = event.target;
|
||||||
|
const isAssetNode =
|
||||||
|
el &&
|
||||||
|
el !== window &&
|
||||||
|
(el.tagName === 'SCRIPT' ||
|
||||||
|
(el.tagName === 'LINK' && /modulepreload|stylesheet/i.test(el.rel || '')));
|
||||||
|
if (isAssetNode || isChunkLoadError(event.error || event.message)) {
|
||||||
|
if (reloadForChunkError()) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
document.addEventListener('visibilitychange', () => {
|
||||||
|
if (document.visibilityState === 'visible') checkDeployedAssets();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkDeployedAssets() {
|
||||||
|
const el = document.querySelector('script[type="module"][src*="/assets/"]');
|
||||||
|
if (!el || !el.src) return;
|
||||||
|
fetch(el.src, { method: 'HEAD', cache: 'no-store', credentials: 'same-origin' })
|
||||||
|
.then(res => {
|
||||||
|
if (res.status === 404) reloadForChunkError();
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,51 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-loading="loading" class="master-detail">
|
<div v-loading="loading" class="master-detail">
|
||||||
<section v-if="master" class="detail-overview">
|
<section v-if="master" class="detail-overview">
|
||||||
<div class="detail-heading"><div><h2>多联总单详情 <span>|</span> {{ master.masterNo }}</h2><el-tag :type="statusType(master.businessStatus)" class="status-text">{{ statusName(master.businessStatus) }}</el-tag><el-tag v-if="transportFlowLabel" type="info" class="transport-flow-tag">{{ transportFlowLabel }}</el-tag></div><el-button @click="$emit('back')">取消</el-button></div>
|
<div class="detail-heading"><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>
|
||||||
<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>
|
<dl class="detail-meta">
|
||||||
|
<div>
|
||||||
|
<dt>客户</dt>
|
||||||
|
<dd>
|
||||||
|
<el-link v-if="master.customerName" type="primary" @click="openCustomer">{{
|
||||||
|
master.customerName
|
||||||
|
}}</el-link>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>合同编号</dt>
|
||||||
|
<dd>
|
||||||
|
<el-link v-if="master.contractNo && master.contractId" type="primary" @click="openContract">{{
|
||||||
|
master.contractNo
|
||||||
|
}}</el-link>
|
||||||
|
<span v-else>{{ master.contractNo || '-' }}</span>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>项目</dt>
|
||||||
|
<dd>
|
||||||
|
<el-link v-if="master.projectName && master.projectId" type="primary" @click="openProject">{{
|
||||||
|
master.projectName
|
||||||
|
}}</el-link>
|
||||||
|
<span v-else>{{ master.projectName || '-' }}</span>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
<div class="detail-meta__attachments">
|
||||||
|
<dt>附件</dt>
|
||||||
|
<dd>
|
||||||
|
<template v-if="attachments.length">
|
||||||
|
<el-link
|
||||||
|
v-for="file in attachments"
|
||||||
|
:key="file.url || file.link || file.name || file.originalName"
|
||||||
|
type="primary"
|
||||||
|
@click="previewAttachment(file)"
|
||||||
|
>{{ attachmentName(file) }}</el-link
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
<div class="route-map"><template v-for="(route, index) in segments" :key="route.segmentNo"><div class="route-map__node"><span :class="['route-badge', index ? 'middle' : 'start']">{{ index ? '经' : '起' }}</span><strong>{{ segmentLocationName(route, 'departure') }}</strong><small>{{ route.departureAddress || '-' }}</small><small class="route-map__progress">{{ index ? `已到达 ${quantity(segments[index - 1].arrivedQuantity)}/${quantity(master.totalQuantity)} ${plannedUnit(segments[index - 1])}` : `已调度 ${quantity(route.dispatchedQuantity)}/${quantity(master.totalQuantity)} ${plannedUnit(route)}` }}</small><small v-if="index" class="route-map__progress">已调度 {{ quantity(route.dispatchedQuantity) }}/{{ quantity(master.totalQuantity) }} {{ plannedUnit(route) }}</small></div><div class="route-map__line"></div><div v-if="index === segments.length - 1" class="route-map__node"><span class="route-badge end">终</span><strong>{{ segmentLocationName(route, 'arrival') }}</strong><small>{{ route.arrivalAddress || '-' }}</small><small class="route-map__progress">已到达 {{ quantity(route.arrivedQuantity) }}/{{ quantity(master.totalQuantity) }} {{ plannedUnit(route) }}</small></div></template></div>
|
<div class="route-map"><template v-for="(route, index) in segments" :key="route.segmentNo"><div class="route-map__node"><span :class="['route-badge', index ? 'middle' : 'start']">{{ index ? '经' : '起' }}</span><strong>{{ segmentLocationName(route, 'departure') }}</strong><small>{{ route.departureAddress || '-' }}</small><small class="route-map__progress">{{ index ? `已到达 ${quantity(segments[index - 1].arrivedQuantity)}/${quantity(master.totalQuantity)} ${plannedUnit(segments[index - 1])}` : `已调度 ${quantity(route.dispatchedQuantity)}/${quantity(master.totalQuantity)} ${plannedUnit(route)}` }}</small><small v-if="index" class="route-map__progress">已调度 {{ quantity(route.dispatchedQuantity) }}/{{ quantity(master.totalQuantity) }} {{ plannedUnit(route) }}</small></div><div class="route-map__line"></div><div v-if="index === segments.length - 1" class="route-map__node"><span class="route-badge end">终</span><strong>{{ segmentLocationName(route, 'arrival') }}</strong><small>{{ route.arrivalAddress || '-' }}</small><small class="route-map__progress">已到达 {{ quantity(route.arrivedQuantity) }}/{{ quantity(master.totalQuantity) }} {{ plannedUnit(route) }}</small></div></template></div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -42,6 +85,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as api from '@/api/business/master-order';
|
import * as api from '@/api/business/master-order';
|
||||||
|
import { getDetail as getProjectDetail } from '@/api/business/project-apply';
|
||||||
|
import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive';
|
||||||
import { CaretBottom, CaretTop } from '@element-plus/icons-vue';
|
import { CaretBottom, CaretTop } from '@element-plus/icons-vue';
|
||||||
import { ElImageViewer } from 'element-plus';
|
import { ElImageViewer } from 'element-plus';
|
||||||
import { OpenFileViewer } from '@open-file-viewer/vue';
|
import { OpenFileViewer } from '@open-file-viewer/vue';
|
||||||
@@ -51,10 +96,26 @@ import pdfWorkerSrc from 'pdfjs-dist/build/pdf.worker.mjs?url';
|
|||||||
|
|
||||||
const viewerPlugins = [imagePlugin(), pdfPlugin({ workerSrc: pdfWorkerSrc, useFetchData: true }), officePlugin({ pdf: { workerSrc: pdfWorkerSrc, useFetchData: true } }), textPlugin(), fallbackPlugin()];
|
const viewerPlugins = [imagePlugin(), pdfPlugin({ workerSrc: pdfWorkerSrc, useFetchData: true }), officePlugin({ pdf: { workerSrc: pdfWorkerSrc, useFetchData: true } }), textPlugin(), fallbackPlugin()];
|
||||||
|
|
||||||
|
const parseJsonArray = value => {
|
||||||
|
if (Array.isArray(value)) return value;
|
||||||
|
if (!value) return [];
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(value);
|
||||||
|
if (Array.isArray(parsed)) return parsed;
|
||||||
|
return parsed && typeof parsed === 'object' ? [parsed] : [];
|
||||||
|
} catch (error) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const customerRowLabel = (row = {}) =>
|
||||||
|
row.customer || row.fullName || row.shortName || row.customerName || row.customerCode || '';
|
||||||
|
|
||||||
|
const customerRowId = (row = {}) => row.id || row.customerId || '';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { ElImageViewer, OpenFileViewer },
|
components: { ElImageViewer, OpenFileViewer },
|
||||||
props: { id: [String, Number] },
|
props: { id: [String, Number] },
|
||||||
emits: ['back'],
|
|
||||||
data() { return { loading: false, master: null, expandedSegments: {}, CaretBottom, CaretTop, imagePreviewVisible: false, imagePreviewUrls: [], imagePreviewIndex: 0, documentPreviewVisible: false, previewFile: {}, viewerPlugins, viewerToolbar: { download: true, fullscreen: true, print: true, rotate: true, zoom: true } }; },
|
data() { return { loading: false, master: null, expandedSegments: {}, CaretBottom, CaretTop, imagePreviewVisible: false, imagePreviewUrls: [], imagePreviewIndex: 0, documentPreviewVisible: false, previewFile: {}, viewerPlugins, viewerToolbar: { download: true, fullscreen: true, print: true, rotate: true, zoom: true } }; },
|
||||||
computed: {
|
computed: {
|
||||||
segments() {
|
segments() {
|
||||||
@@ -148,6 +209,68 @@ export default {
|
|||||||
this.$router.push({ path: '/business/waybill-manage/detail', query: { id: row.id } });
|
this.$router.push({ path: '/business/waybill-manage/detail', query: { id: row.id } });
|
||||||
},
|
},
|
||||||
openPlan(row) { this.$router.push({ path: '/business/transport-plan', query: { detailId: row.id } }); },
|
openPlan(row) { this.$router.push({ path: '/business/transport-plan', query: { detailId: row.id } }); },
|
||||||
|
openContract() {
|
||||||
|
if (!this.master?.contractId) {
|
||||||
|
this.$message.warning('合同信息缺失,无法打开');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$router.push({
|
||||||
|
path: '/business/contract-manage/detail',
|
||||||
|
query: { id: this.master.contractId, name: '合同详情' },
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openProject() {
|
||||||
|
if (!this.master?.projectId) {
|
||||||
|
this.$message.warning('项目信息缺失,无法打开');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$router.push({
|
||||||
|
path: '/business/project-apply/form',
|
||||||
|
query: { mode: 'view', id: this.master.projectId, name: '查看项目管理' },
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async resolveCustomerId() {
|
||||||
|
if (this.master?.customerId) return this.master.customerId;
|
||||||
|
const name = String(this.master?.customerName || '').trim();
|
||||||
|
if (!name) return '';
|
||||||
|
if (this.master?.projectId) {
|
||||||
|
try {
|
||||||
|
const res = await getProjectDetail(this.master.projectId);
|
||||||
|
const rows = parseJsonArray(res.data?.data?.customerJson);
|
||||||
|
const matched =
|
||||||
|
rows.find(row => customerRowLabel(row) === name) ||
|
||||||
|
rows.find(row => {
|
||||||
|
const label = customerRowLabel(row);
|
||||||
|
return label && (name.includes(label) || label.includes(name));
|
||||||
|
});
|
||||||
|
const id = customerRowId(matched);
|
||||||
|
if (id) return id;
|
||||||
|
} catch (error) {
|
||||||
|
// 项目客户解析失败时回退到客商档案检索
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const res = await getCustomerArchiveList(1, 20, { fullName: name });
|
||||||
|
const records = res.data?.data?.records || [];
|
||||||
|
const exact =
|
||||||
|
records.find(item => item.fullName === name || item.shortName === name) || records[0];
|
||||||
|
return exact?.id || '';
|
||||||
|
} catch (error) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async openCustomer() {
|
||||||
|
if (!this.master?.customerName) return;
|
||||||
|
const customerId = await this.resolveCustomerId();
|
||||||
|
if (!customerId) {
|
||||||
|
this.$message.warning('未找到对应客商档案,无法打开');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$router.push({
|
||||||
|
path: '/vehicle/customer-archive/form',
|
||||||
|
query: { id: String(customerId), name: '查看客商档案', view: '1' },
|
||||||
|
});
|
||||||
|
},
|
||||||
waybillStatusName(value) { return ({ pending: '待执行', waiting: '待执行', running: '进行中', processing: '进行中', completed: '已完成', cancelled: '已取消' })[value] || value || '-'; },
|
waybillStatusName(value) { return ({ pending: '待执行', waiting: '待执行', running: '进行中', processing: '进行中', completed: '已完成', cancelled: '已取消' })[value] || value || '-'; },
|
||||||
waybillStatusType(value) { return ({ pending: 'info', waiting: 'info', running: 'warning', processing: 'warning', completed: 'success', cancelled: 'danger' })[value] || 'info'; },
|
waybillStatusType(value) { return ({ pending: 'info', waiting: 'info', running: 'warning', processing: 'warning', completed: 'success', cancelled: 'danger' })[value] || 'info'; },
|
||||||
statusName(value) { return ({ waiting_dispatch: '待调度', dispatching: '调度中', completed: '调度完成', closed: '调度关闭' })[value] || value || '-'; },
|
statusName(value) { return ({ waiting_dispatch: '待调度', dispatching: '调度中', completed: '调度完成', closed: '调度关闭' })[value] || value || '-'; },
|
||||||
@@ -161,7 +284,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: #409eff; font-size: 14px; word-break: break-all; } }
|
.detail-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 24px; margin: 0; padding: 0 24px 20px; dt { margin-bottom: 6px; color: #909399; font-size: 13px; } dd { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; color: #303133; font-size: 14px; word-break: break-all; } :deep(.el-link) { font-size: 14px; } }
|
||||||
.route-map { display: flex; align-items: flex-start; padding: 16px 24px 20px; border-top: 1px solid #eff1f7; overflow-x: auto; }
|
.route-map { display: flex; align-items: flex-start; padding: 16px 24px 20px; border-top: 1px solid #eff1f7; overflow-x: auto; }
|
||||||
.route-map__node { display: grid; flex: 0 0 150px; justify-items: center; gap: 6px; text-align: center; strong { font-size: 16px; white-space: nowrap; } small { color: #606266; white-space: nowrap; } }
|
.route-map__node { display: grid; flex: 0 0 150px; justify-items: center; gap: 6px; text-align: center; strong { font-size: 16px; white-space: nowrap; } small { color: #606266; white-space: nowrap; } }
|
||||||
.route-map__progress { color: #303133 !important; }
|
.route-map__progress { color: #303133 !important; }
|
||||||
|
|||||||
@@ -95,10 +95,51 @@
|
|||||||
<div class="goods-heading"><h3>货物信息</h3><div><el-link type="primary" @click="addGoods(route)">新增货物</el-link></div></div>
|
<div class="goods-heading"><h3>货物信息</h3><div><el-link type="primary" @click="addGoods(route)">新增货物</el-link></div></div>
|
||||||
<el-table :data="route.goods" border class="goods-table">
|
<el-table :data="route.goods" border class="goods-table">
|
||||||
<el-table-column type="index" label="序号" width="64" />
|
<el-table-column type="index" label="序号" width="64" />
|
||||||
<el-table-column min-width="180"><template #header><span>货物类型<span class="goods-required-mark">*</span></span></template><template #default="{ row }"><el-cascader v-model="row.cargoTypePath" class="goods-table__cargo-type" :options="cargoTypeOptions" :props="cargoTypeCascaderProps" placeholder="请选择货物类型" clearable filterable @change="value => handleCargoTypeChange(route, row, value)" /></template></el-table-column>
|
<el-table-column min-width="180"
|
||||||
<el-table-column min-width="180"><template #header><span>货物名称<span class="goods-required-mark">*</span></span></template><template #default="{ row }"><el-select v-model="row.sourceIndex" class="goods-table__cargo-name" placeholder="请选择总单货物" @change="selectGoods(route, row)"><el-option v-for="item in masterGoodsByCargoType(row)" :key="item.sourceIndex" :label="item.cargoName" :value="item.sourceIndex" /></el-select></template></el-table-column>
|
><template #header
|
||||||
<el-table-column prop="remainingQuantity" column-key="remainingQuantity" label="剩余数量" width="150" class-name="goods-table__remaining"><template #default="{ row }">{{ formatQuantity(goodsRemainingQuantity(route, row)) }}</template></el-table-column>
|
><span>货物类型<span class="goods-required-mark">*</span></span></template
|
||||||
<el-table-column prop="dispatchQuantity" column-key="dispatchQuantity" width="200" class-name="goods-table__dispatch"><template #header><span>本次数量<span class="goods-required-mark">*</span></span></template><template #default="{ row }"><el-input :model-value="row.dispatchQuantity" inputmode="decimal" placeholder="请输入" @input="value => handleDispatchQuantityInput(route, row, value)" /></template></el-table-column>
|
><template #default="{ row }"
|
||||||
|
><el-autocomplete
|
||||||
|
v-model="row.cargoType"
|
||||||
|
class="goods-table__cargo-type"
|
||||||
|
clearable
|
||||||
|
:debounce="300"
|
||||||
|
placeholder="请输入货物类型"
|
||||||
|
:fetch-suggestions="fetchCargoTypeSuggestions"
|
||||||
|
@select="item => handleCargoTypeSelect(route, row, item)"
|
||||||
|
@change="value => handleCargoTypeChange(route, row, value)"
|
||||||
|
/></template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column min-width="180"
|
||||||
|
><template #header
|
||||||
|
><span>货物名称<span class="goods-required-mark">*</span></span></template
|
||||||
|
><template #default="{ row }"
|
||||||
|
><el-select
|
||||||
|
v-model="row.sourceIndex"
|
||||||
|
class="goods-table__cargo-name"
|
||||||
|
placeholder="请选择总单货物"
|
||||||
|
@change="selectGoods(route, row)"
|
||||||
|
><el-option
|
||||||
|
v-for="item in masterGoodsByCargoType(row)"
|
||||||
|
:key="item.sourceIndex"
|
||||||
|
:label="item.cargoName"
|
||||||
|
:value="item.sourceIndex" /></el-select
|
||||||
|
></template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="dispatchQuantity"
|
||||||
|
column-key="dispatchQuantity"
|
||||||
|
width="200"
|
||||||
|
class-name="goods-table__dispatch"
|
||||||
|
><template #header
|
||||||
|
><span>本次数量<span class="goods-required-mark">*</span></span></template
|
||||||
|
><template #default="{ row }"
|
||||||
|
><el-input
|
||||||
|
:model-value="row.dispatchQuantity"
|
||||||
|
inputmode="decimal"
|
||||||
|
placeholder="请输入"
|
||||||
|
@input="value => handleDispatchQuantityInput(route, row, value)" /></template
|
||||||
|
></el-table-column>
|
||||||
<el-table-column prop="quantityUnit" width="110"><template #header><span>数量单位<span class="goods-required-mark">*</span></span></template></el-table-column>
|
<el-table-column prop="quantityUnit" width="110"><template #header><span>数量单位<span class="goods-required-mark">*</span></span></template></el-table-column>
|
||||||
<el-table-column prop="packageType" label="包装" min-width="110" />
|
<el-table-column prop="packageType" label="包装" min-width="110" />
|
||||||
<el-table-column prop="brand" label="品牌" min-width="110" />
|
<el-table-column prop="brand" label="品牌" min-width="110" />
|
||||||
@@ -208,7 +249,7 @@ export default {
|
|||||||
props: { id: [String, Number] },
|
props: { id: [String, Number] },
|
||||||
emits: ['back'],
|
emits: ['back'],
|
||||||
data() {
|
data() {
|
||||||
return { loading: false, submitting: false, master: null, routes: [], pending: [], pendingExpanded: false, editingId: null, driverInputs: {}, carrierOptions: [], driverOptions: [], carrierLoading: false, driverLoading: false, escortLoading: false, cargoTypeOptions: [], cargoTypeCascaderProps: { label: 'cargoName', value: 'id', children: 'children', emitPath: true }, quantityUnitOptions: ['吨', '千克', '立方米', '件', '车', '箱', '托盘'] };
|
return { loading: false, submitting: false, master: null, routes: [], pending: [], pendingExpanded: false, editingId: null, driverInputs: {}, carrierOptions: [], driverOptions: [], carrierLoading: false, driverLoading: false, escortLoading: false, quantityUnitOptions: ['吨', '千克', '立方米', '件', '车', '箱', '托盘'] };
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
totalQuantity() { return (this.master?.goods || []).reduce((sum, item) => sum + Number(item.quantity || 0), 0); },
|
totalQuantity() { return (this.master?.goods || []).reduce((sum, item) => sum + Number(item.quantity || 0), 0); },
|
||||||
@@ -216,6 +257,9 @@ export default {
|
|||||||
goodsNames() { return (this.master?.goods || []).map(item => item.cargoName).filter(Boolean).join('、') || '-'; },
|
goodsNames() { return (this.master?.goods || []).map(item => item.cargoName).filter(Boolean).join('、') || '-'; },
|
||||||
goodsTypes() { return [...new Set((this.master?.goods || []).map(item => item.cargoType).filter(Boolean))].join('、') || '-'; },
|
goodsTypes() { return [...new Set((this.master?.goods || []).map(item => item.cargoType).filter(Boolean))].join('、') || '-'; },
|
||||||
masterGoods() { return (this.master?.goods || []).map((item, sourceIndex) => ({ ...item, sourceIndex, label: [item.cargoName, item.cargoType].filter(Boolean).join(' / ') })); },
|
masterGoods() { return (this.master?.goods || []).map((item, sourceIndex) => ({ ...item, sourceIndex, label: [item.cargoName, item.cargoType].filter(Boolean).join(' / ') })); },
|
||||||
|
cargoTypeSelectOptions() {
|
||||||
|
return [...new Set((this.master?.goods || []).map(item => item.cargoType).filter(Boolean))];
|
||||||
|
},
|
||||||
dateRange() { return this.master?.planStartTime && this.master?.planEndTime ? `${String(this.master.planStartTime).slice(0, 10)} ~ ${String(this.master.planEndTime).slice(0, 10)}` : '-'; },
|
dateRange() { return this.master?.planStartTime && this.master?.planEndTime ? `${String(this.master.planStartTime).slice(0, 10)} ~ ${String(this.master.planEndTime).slice(0, 10)}` : '-'; },
|
||||||
pendingGroups() {
|
pendingGroups() {
|
||||||
return this.pending.reduce((groups, item, index) => {
|
return this.pending.reduce((groups, item, index) => {
|
||||||
@@ -256,7 +300,6 @@ 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; }
|
||||||
},
|
},
|
||||||
@@ -318,46 +361,42 @@ export default {
|
|||||||
this.syncFreightItems(route);
|
this.syncFreightItems(route);
|
||||||
return route;
|
return route;
|
||||||
},
|
},
|
||||||
buildMasterCargoTypeOptions(goods = []) {
|
|
||||||
return [...new Set(goods.map(item => item.cargoType).filter(Boolean))].map(cargoType => ({
|
|
||||||
id: cargoType,
|
|
||||||
cargoName: cargoType,
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
masterGoodsByCargoType(row = {}) {
|
masterGoodsByCargoType(row = {}) {
|
||||||
return this.masterGoods.filter(item => !row.cargoType || item.cargoType === row.cargoType);
|
const cargoType = String(row.cargoType || '').trim();
|
||||||
|
if (!cargoType) return this.masterGoods;
|
||||||
|
const matched = this.masterGoods.filter(item => item.cargoType === cargoType);
|
||||||
|
return matched.length ? matched : this.masterGoods;
|
||||||
},
|
},
|
||||||
findCargoTypeByPath(path = []) {
|
fetchCargoTypeSuggestions(queryString, callback) {
|
||||||
let options = this.cargoTypeOptions;
|
const keyword = String(queryString || '').trim().toLowerCase();
|
||||||
let selected;
|
const options = this.cargoTypeSelectOptions.map(item => ({ value: item }));
|
||||||
(path || []).forEach(id => {
|
callback(
|
||||||
selected = (options || []).find(item => String(item.id) === String(id));
|
keyword ? options.filter(item => String(item.value).toLowerCase().includes(keyword)) : options
|
||||||
options = selected?.children || [];
|
);
|
||||||
});
|
|
||||||
return selected;
|
|
||||||
},
|
},
|
||||||
findCargoTypePath(cargoType, options = this.cargoTypeOptions, parentPath = []) {
|
handleCargoTypeSelect(route, row, item = {}) {
|
||||||
for (const option of options || []) {
|
this.handleCargoTypeChange(route, row, item.value || '');
|
||||||
const path = [...parentPath, option.id];
|
|
||||||
if (option.cargoName === cargoType) return path;
|
|
||||||
if (option.children?.length) {
|
|
||||||
const result = this.findCargoTypePath(cargoType, option.children, path);
|
|
||||||
if (result.length) return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
},
|
},
|
||||||
handleCargoTypeChange(route, row, value) {
|
handleCargoTypeChange(route, row, value) {
|
||||||
const path = Array.isArray(value) ? value : [];
|
row.cargoType = String(value ?? row.cargoType ?? '').trim();
|
||||||
const cargoType = this.findCargoTypeByPath(path);
|
const matched = this.masterGoods.filter(item => item.cargoType === row.cargoType);
|
||||||
row.cargoTypePath = path;
|
const firstGoods = matched[0];
|
||||||
row.cargoType = cargoType?.cargoName || '';
|
|
||||||
const firstGoods = this.masterGoodsByCargoType(row)[0];
|
|
||||||
if (firstGoods) {
|
if (firstGoods) {
|
||||||
row.sourceIndex = firstGoods.sourceIndex;
|
row.sourceIndex = firstGoods.sourceIndex;
|
||||||
this.selectGoods(route, row);
|
this.selectGoods(route, row);
|
||||||
|
} else {
|
||||||
|
Object.assign(row, {
|
||||||
|
sourceIndex: undefined,
|
||||||
|
cargoName: '',
|
||||||
|
quantity: '',
|
||||||
|
quantityUnit: '',
|
||||||
|
packageType: '',
|
||||||
|
brand: '',
|
||||||
|
specification: '',
|
||||||
|
model: '',
|
||||||
|
materialCode: '',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else Object.assign(row, { sourceIndex: undefined, cargoName: '', quantity: '', quantityUnit: '' });
|
|
||||||
this.syncFreightItems(route);
|
this.syncFreightItems(route);
|
||||||
},
|
},
|
||||||
isRoad(route) {
|
isRoad(route) {
|
||||||
@@ -542,52 +581,47 @@ export default {
|
|||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
pendingGoodsQuantity(route, row) {
|
|
||||||
const goodsIndex = this.masterGoodsIndex(row);
|
|
||||||
return this.pending.reduce((sum, item) => {
|
|
||||||
if (!this.isSameRouteSegment(route, item)) return sum;
|
|
||||||
const pendingGoodsIndex = this.masterGoodsIndex(item);
|
|
||||||
if (
|
|
||||||
(goodsIndex >= 0 && pendingGoodsIndex >= 0 && pendingGoodsIndex !== goodsIndex) ||
|
|
||||||
(goodsIndex < 0 && !this.isSameGoods(item, row))
|
|
||||||
) {
|
|
||||||
return sum;
|
|
||||||
}
|
|
||||||
return sum + this.quantityNumber(item.quantity);
|
|
||||||
}, 0);
|
|
||||||
},
|
|
||||||
isSameRouteSegment(route = {}, item = {}) {
|
isSameRouteSegment(route = {}, item = {}) {
|
||||||
const routeSegment = route.segmentNo || route.relationNo || '';
|
const routeSegment = route.segmentNo || route.relationNo || '';
|
||||||
const itemSegment = item.segmentNo || item.relationNo || '';
|
const itemSegment = item.segmentNo || item.relationNo || '';
|
||||||
return String(routeSegment) === String(itemSegment);
|
return String(routeSegment) === String(itemSegment);
|
||||||
},
|
},
|
||||||
editingGoodsQuantity(route, row) {
|
|
||||||
return (route.goods || []).reduce((sum, item) => {
|
|
||||||
if (item === row || !this.isSameGoods(item, row)) return sum;
|
|
||||||
return sum + this.quantityNumber(item.dispatchQuantity);
|
|
||||||
}, 0);
|
|
||||||
},
|
|
||||||
goodsRemainingQuantity(route, row) {
|
|
||||||
return Math.max(
|
|
||||||
0,
|
|
||||||
this.baseGoodsRemainingQuantity(route, row) -
|
|
||||||
this.pendingGoodsQuantity(route, row) -
|
|
||||||
this.editingGoodsQuantity(route, row)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
availableDispatchQuantity(route, row) { return this.goodsRemainingQuantity(route, row); },
|
|
||||||
handleDispatchQuantityInput(route, row, value) {
|
handleDispatchQuantityInput(route, row, value) {
|
||||||
const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.');
|
const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.');
|
||||||
const nextValue = decimal || String(value || '').includes('.') ? `${integer}.${decimal.slice(0, 3)}` : integer;
|
row.dispatchQuantity =
|
||||||
const availableQuantity = this.availableDispatchQuantity(route, row);
|
decimal || String(value || '').includes('.') ? `${integer}.${decimal.slice(0, 3)}` : integer;
|
||||||
if (Number(nextValue || 0) > availableQuantity) {
|
|
||||||
row.dispatchQuantity = this.formatQuantity(availableQuantity);
|
|
||||||
this.syncFreightItems(route);
|
this.syncFreightItems(route);
|
||||||
this.$message.warning('本次数量不能超过剩余数量');
|
},
|
||||||
return;
|
validatePendingTotals() {
|
||||||
|
for (const route of this.routes) {
|
||||||
|
const items = this.pending.filter(item => this.isSameRouteSegment(route, item));
|
||||||
|
if (!items.length) continue;
|
||||||
|
if (!this.validatePreviousSegmentCompletedQuantity(route, [])) return false;
|
||||||
|
|
||||||
|
const totals = new Map();
|
||||||
|
for (const item of items) {
|
||||||
|
const index = this.masterGoodsIndex(item);
|
||||||
|
const key = index >= 0 ? `i:${index}` : this.goodsKey(item);
|
||||||
|
totals.set(key, (totals.get(key) || 0) + this.quantityNumber(item.quantity));
|
||||||
}
|
}
|
||||||
row.dispatchQuantity = nextValue;
|
for (const [key, qty] of totals.entries()) {
|
||||||
this.syncFreightItems(route);
|
if (!key.startsWith('i:')) continue;
|
||||||
|
const sourceIndex = Number(key.slice(2));
|
||||||
|
const masterGoods = this.master?.goods?.[sourceIndex];
|
||||||
|
if (!masterGoods) continue;
|
||||||
|
const available = this.baseGoodsRemainingQuantity(route, {
|
||||||
|
...masterGoods,
|
||||||
|
sourceIndex,
|
||||||
|
});
|
||||||
|
if (qty > available) {
|
||||||
|
this.$message.warning(
|
||||||
|
`${route.segmentNo}「${masterGoods.cargoName || ''}」调度总量不能超过剩余数量(${this.formatQuantity(available)} ${masterGoods.quantityUnit || this.quantityUnitLabel})`
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
handleFreightUnitPriceInput(item, value) {
|
handleFreightUnitPriceInput(item, value) {
|
||||||
const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.');
|
const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.');
|
||||||
@@ -618,7 +652,7 @@ export default {
|
|||||||
const index = (route.goods || []).indexOf(item) + 1;
|
const index = (route.goods || []).indexOf(item) + 1;
|
||||||
const fields = [
|
const fields = [
|
||||||
[!String(item.cargoName || '').trim() || item.sourceIndex === undefined || item.sourceIndex === null || item.sourceIndex === '', '货物名称'],
|
[!String(item.cargoName || '').trim() || item.sourceIndex === undefined || item.sourceIndex === null || item.sourceIndex === '', '货物名称'],
|
||||||
[!String(item.cargoType || '').trim() && !(item.cargoTypePath || []).length, '货物类型'],
|
[!String(item.cargoType || '').trim(), '货物类型'],
|
||||||
[item.dispatchQuantity === undefined || item.dispatchQuantity === null || item.dispatchQuantity === '' || Number(item.dispatchQuantity) <= 0, '本次数量'],
|
[item.dispatchQuantity === undefined || item.dispatchQuantity === null || item.dispatchQuantity === '' || Number(item.dispatchQuantity) <= 0, '本次数量'],
|
||||||
[!String(item.quantityUnit || '').trim(), '数量单位'],
|
[!String(item.quantityUnit || '').trim(), '数量单位'],
|
||||||
];
|
];
|
||||||
@@ -650,7 +684,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
...goods,
|
...goods,
|
||||||
sourceIndex,
|
sourceIndex,
|
||||||
cargoTypePath: this.findCargoTypePath(goods.cargoType),
|
|
||||||
dispatchQuantity: undefined,
|
dispatchQuantity: undefined,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -666,7 +699,8 @@ export default {
|
|||||||
selectGoods(route, row) {
|
selectGoods(route, row) {
|
||||||
const source = (this.master.goods || [])[Number(row.sourceIndex)];
|
const source = (this.master.goods || [])[Number(row.sourceIndex)];
|
||||||
if (!source) return;
|
if (!source) return;
|
||||||
Object.assign(row, this.createGoodsRow(source, Number(row.sourceIndex)));
|
const cargoType = String(row.cargoType || '').trim() || source.cargoType;
|
||||||
|
Object.assign(row, this.createGoodsRow(source, Number(row.sourceIndex)), { cargoType });
|
||||||
this.syncFreightItems(route);
|
this.syncFreightItems(route);
|
||||||
},
|
},
|
||||||
removeGoods(route, index) { route.goods.splice(index, 1); this.syncFreightItems(route); },
|
removeGoods(route, index) { route.goods.splice(index, 1); this.syncFreightItems(route); },
|
||||||
@@ -854,8 +888,6 @@ export default {
|
|||||||
const goods = route.goods.filter(item => Number(item.dispatchQuantity) > 0);
|
const goods = route.goods.filter(item => Number(item.dispatchQuantity) > 0);
|
||||||
if (!goods.length) return this.$message.warning('请填写本次数量');
|
if (!goods.length) return this.$message.warning('请填写本次数量');
|
||||||
if (!this.validateDispatchGoods(route, goods)) return;
|
if (!this.validateDispatchGoods(route, goods)) return;
|
||||||
if (goods.some(item => Number(item.dispatchQuantity) > this.availableDispatchQuantity(route, item))) return this.$message.warning('本次数量不能超过剩余数量');
|
|
||||||
if (!this.validatePreviousSegmentCompletedQuantity(route, goods)) return;
|
|
||||||
this.syncFreightItems(route);
|
this.syncFreightItems(route);
|
||||||
if (!this.validateFreightItems(route)) return;
|
if (!this.validateFreightItems(route)) return;
|
||||||
if (!this.validateRoutePhones(route)) return;
|
if (!this.validateRoutePhones(route)) return;
|
||||||
@@ -954,6 +986,7 @@ export default {
|
|||||||
async submit() {
|
async submit() {
|
||||||
if (!this.pending.length) return this.$message.warning('请加入待提交调度清单');
|
if (!this.pending.length) return this.$message.warning('请加入待提交调度清单');
|
||||||
if (this.pending.some(item => !this.validateRoutePhones(item))) return;
|
if (this.pending.some(item => !this.validateRoutePhones(item))) return;
|
||||||
|
if (!this.validatePendingTotals()) return;
|
||||||
this.submitting = true;
|
this.submitting = true;
|
||||||
try { await api.dispatch({ id: this.master.id, dispatches: this.pending.map(({ id, ...item }) => ({ ...item, mileage: this.normalizeMileage(item.mileage) })) }); this.$message.success('调度成功'); this.$emit('back'); } finally { this.submitting = false; }
|
try { await api.dispatch({ id: this.master.id, dispatches: this.pending.map(({ id, ...item }) => ({ ...item, mileage: this.normalizeMileage(item.mileage) })) }); this.$message.success('调度成功'); this.$emit('back'); } finally { this.submitting = false; }
|
||||||
},
|
},
|
||||||
@@ -985,7 +1018,7 @@ export default {
|
|||||||
.transport-type-field :deep(.el-input) { width: 240px; }
|
.transport-type-field :deep(.el-input) { width: 240px; }
|
||||||
.goods-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 -24px 12px; padding: 14px 24px; border-top: 1px solid #eff1f7; border-bottom: 1px solid #eff1f7; h3 { margin: 0; padding-left: 12px; border-left: 4px solid #409eff; font-size: 16px; } span { color: #909399; font-size: 13px; } }
|
.goods-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 -24px 12px; padding: 14px 24px; border-top: 1px solid #eff1f7; border-bottom: 1px solid #eff1f7; h3 { margin: 0; padding-left: 12px; border-left: 4px solid #409eff; font-size: 16px; } span { color: #909399; font-size: 13px; } }
|
||||||
.freight-heading { margin: 16px 0 12px; h3 { margin: 0; padding-left: 12px; border-left: 4px solid #409eff; font-size: 16px; } }
|
.freight-heading { margin: 16px 0 12px; h3 { margin: 0; padding-left: 12px; border-left: 4px solid #409eff; font-size: 16px; } }
|
||||||
.goods-table { :deep(th.el-table__cell), :deep(td.el-table__cell) { border-color: #eff1f7; } :deep(.el-table__row--striped td.el-table__cell) { background: #fafafa; } :deep(.goods-table__remaining .cell) { white-space: nowrap; } :deep(.goods-table__dispatch .el-input) { width: 100%; min-width: 0; } :deep(.goods-table__cargo-type .el-input__inner), :deep(.goods-table__cargo-name .el-select__selected-item) { color: #303133; } }
|
.goods-table { :deep(th.el-table__cell), :deep(td.el-table__cell) { border-color: #eff1f7; } :deep(.el-table__row--striped td.el-table__cell) { background: #fafafa; } :deep(.goods-table__dispatch .el-input) { width: 100%; min-width: 0; } :deep(.goods-table__cargo-type), :deep(.goods-table__cargo-name) { width: 100%; } :deep(.goods-table__cargo-type .el-input__inner), :deep(.goods-table__cargo-name .el-select__selected-item) { color: #303133; } }
|
||||||
.goods-required-mark { margin-left: 2px; color: #f56c6c; }
|
.goods-required-mark { margin-left: 2px; color: #f56c6c; }
|
||||||
.freight-form { :deep(.freight-unit-select) { width: 92px; flex: 0 0 92px; min-width: 0; } }
|
.freight-form { :deep(.freight-unit-select) { width: 92px; flex: 0 0 92px; min-width: 0; } }
|
||||||
.carrier-type-form { margin-top: 16px; }
|
.carrier-type-form { margin-top: 16px; }
|
||||||
|
|||||||
@@ -146,8 +146,9 @@
|
|||||||
/>
|
/>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.departureAddress"
|
v-model="form.departureAddress"
|
||||||
placeholder="请输入发货地址"
|
class="shipping-template-page__address-map-input"
|
||||||
:readonly="transportStationMode || !config.editableRoadAddress"
|
readonly
|
||||||
|
placeholder="请选择发货地址"
|
||||||
:disabled="transportAddressSelectDisabled"
|
:disabled="transportAddressSelectDisabled"
|
||||||
@click="handleTransportSecondaryAddressInputClick('departure')"
|
@click="handleTransportSecondaryAddressInputClick('departure')"
|
||||||
>
|
>
|
||||||
@@ -189,8 +190,9 @@
|
|||||||
/>
|
/>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.arrivalAddress"
|
v-model="form.arrivalAddress"
|
||||||
placeholder="请输入收货地址"
|
class="shipping-template-page__address-map-input"
|
||||||
:readonly="transportStationMode || !config.editableRoadAddress"
|
readonly
|
||||||
|
placeholder="请选择收货地址"
|
||||||
:disabled="transportAddressSelectDisabled"
|
:disabled="transportAddressSelectDisabled"
|
||||||
@click="handleTransportSecondaryAddressInputClick('arrival')"
|
@click="handleTransportSecondaryAddressInputClick('arrival')"
|
||||||
>
|
>
|
||||||
@@ -1131,7 +1133,7 @@ const defaultCargo = () => ({
|
|||||||
cargoTypePath: [],
|
cargoTypePath: [],
|
||||||
packageType: '',
|
packageType: '',
|
||||||
quantity: '',
|
quantity: '',
|
||||||
quantityUnit: '',
|
quantityUnit: '吨',
|
||||||
brand: '',
|
brand: '',
|
||||||
specification: '',
|
specification: '',
|
||||||
model: '',
|
model: '',
|
||||||
@@ -1258,6 +1260,7 @@ export default {
|
|||||||
crudDialogType: '',
|
crudDialogType: '',
|
||||||
standaloneFormKey: '',
|
standaloneFormKey: '',
|
||||||
copyingRow: null,
|
copyingRow: null,
|
||||||
|
suppressTransportTypeClear: false,
|
||||||
detailBox: false,
|
detailBox: false,
|
||||||
detailLoading: false,
|
detailLoading: false,
|
||||||
detailRow: {},
|
detailRow: {},
|
||||||
@@ -1511,10 +1514,10 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
'form.transportType'(value, oldValue) {
|
'form.transportType'(value, oldValue) {
|
||||||
if (value !== oldValue) {
|
if (this.suppressTransportTypeClear) return;
|
||||||
|
if (String(value ?? '') === String(oldValue ?? '')) return;
|
||||||
this.handleTransportTypeChange(value);
|
this.handleTransportTypeChange(value);
|
||||||
this.syncFreightItems();
|
this.syncFreightItems();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -1527,6 +1530,20 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
buildOption(option) {
|
buildOption(option) {
|
||||||
const next = { ...option, column: (option.column || []).map(column => ({ ...column })) };
|
const next = { ...option, column: (option.column || []).map(column => ({ ...column })) };
|
||||||
|
const tableOrder = this.config.tableColumnOrder || [];
|
||||||
|
if (tableOrder.length) {
|
||||||
|
const orderMap = new Map(tableOrder.map((prop, index) => [prop, index]));
|
||||||
|
next.column.sort((left, right) => {
|
||||||
|
const leftOrder = orderMap.has(left.prop) ? orderMap.get(left.prop) : tableOrder.length;
|
||||||
|
const rightOrder = orderMap.has(right.prop)
|
||||||
|
? orderMap.get(right.prop)
|
||||||
|
: tableOrder.length;
|
||||||
|
return leftOrder - rightOrder;
|
||||||
|
});
|
||||||
|
next.column.forEach(column => {
|
||||||
|
if (column.prop) column.hide = !orderMap.has(column.prop);
|
||||||
|
});
|
||||||
|
}
|
||||||
if (this.menuWidth != null) next.menuWidth = this.menuWidth;
|
if (this.menuWidth != null) next.menuWidth = this.menuWidth;
|
||||||
if (
|
if (
|
||||||
this.standaloneFormPage &&
|
this.standaloneFormPage &&
|
||||||
@@ -1790,6 +1807,7 @@ export default {
|
|||||||
console.log('进入复制模式分支');
|
console.log('进入复制模式分支');
|
||||||
const copyData = { ...this.copyingRow };
|
const copyData = { ...this.copyingRow };
|
||||||
this.copyingRow = null;
|
this.copyingRow = null;
|
||||||
|
this.suppressTransportTypeClear = true;
|
||||||
this.form = { ...(this.config.defaultForm || {}), ...copyData };
|
this.form = { ...(this.config.defaultForm || {}), ...copyData };
|
||||||
console.log('合并后的 form:', this.form);
|
console.log('合并后的 form:', this.form);
|
||||||
// 删除模板编号,等待系统生成
|
// 删除模板编号,等待系统生成
|
||||||
@@ -1842,7 +1860,11 @@ export default {
|
|||||||
done?.();
|
done?.();
|
||||||
},
|
},
|
||||||
applyFormDetail(row) {
|
applyFormDetail(row) {
|
||||||
|
this.suppressTransportTypeClear = true;
|
||||||
this.form = { ...(row || {}) };
|
this.form = { ...(row || {}) };
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.suppressTransportTypeClear = false;
|
||||||
|
});
|
||||||
this.selectedProjectId = this.form.projectId || '';
|
this.selectedProjectId = this.form.projectId || '';
|
||||||
this.transportCargoRows = this.parseJsonArray(this.form.goodsJson).map(item =>
|
this.transportCargoRows = this.parseJsonArray(this.form.goodsJson).map(item =>
|
||||||
this.normalizeCargo(item)
|
this.normalizeCargo(item)
|
||||||
@@ -1924,14 +1946,6 @@ export default {
|
|||||||
this.$message.warning(`第${index + 1}行货物类型不能为空`);
|
this.$message.warning(`第${index + 1}行货物类型不能为空`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!String(row.cargoName || '').trim() || !row.quantity || !row.quantityUnit) {
|
|
||||||
this.$message.warning(`第${index + 1}行货物信息不完整`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (Number(row.quantity) <= 0) {
|
|
||||||
this.$message.warning(`第${index + 1}行数量必须大于0`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (String(row.remark || '').length > 200) {
|
if (String(row.remark || '').length > 200) {
|
||||||
this.$message.warning(`第${index + 1}行备注不能超过200个字符`);
|
this.$message.warning(`第${index + 1}行备注不能超过200个字符`);
|
||||||
return false;
|
return false;
|
||||||
@@ -2013,6 +2027,8 @@ export default {
|
|||||||
delete detail.updateUser;
|
delete detail.updateUser;
|
||||||
delete detail.updateUserName;
|
delete detail.updateUserName;
|
||||||
delete detail.status;
|
delete detail.status;
|
||||||
|
// 模板名称追加「副本」
|
||||||
|
detail.templateName = `${detail.templateName || ''}副本`;
|
||||||
|
|
||||||
console.log('处理后的数据:', detail);
|
console.log('处理后的数据:', detail);
|
||||||
console.log('isStandaloneBusinessPage:', this.isStandaloneBusinessPage);
|
console.log('isStandaloneBusinessPage:', this.isStandaloneBusinessPage);
|
||||||
@@ -2286,12 +2302,59 @@ export default {
|
|||||||
},
|
},
|
||||||
handleTransportTypeChange(value) {
|
handleTransportTypeChange(value) {
|
||||||
this.form.transportTypeName = this.getTransportTypeLabel(value);
|
this.form.transportTypeName = this.getTransportTypeLabel(value);
|
||||||
|
this.clearTransportShippingInfo();
|
||||||
|
},
|
||||||
|
clearTransportShippingInfo() {
|
||||||
|
[
|
||||||
|
'departureName',
|
||||||
|
'departureAddress',
|
||||||
|
'departureAddressCode',
|
||||||
|
'departureSiteCode',
|
||||||
|
'departureLongitude',
|
||||||
|
'departureLatitude',
|
||||||
|
'departureContact',
|
||||||
|
'departurePhone',
|
||||||
|
'arrivalName',
|
||||||
|
'arrivalAddress',
|
||||||
|
'arrivalAddressCode',
|
||||||
|
'arrivalSiteCode',
|
||||||
|
'arrivalLongitude',
|
||||||
|
'arrivalLatitude',
|
||||||
|
'arrivalContact',
|
||||||
|
'arrivalPhone',
|
||||||
|
].forEach(prop => {
|
||||||
|
this.form[prop] = '';
|
||||||
|
});
|
||||||
|
this.transportMapSelected = {};
|
||||||
|
this.transportRouteBox = false;
|
||||||
|
this.transportAddressBox = false;
|
||||||
|
this.transportStationBox = false;
|
||||||
|
this.transportMapBox = false;
|
||||||
|
this.transportAddressTarget = '';
|
||||||
|
this.transportStationTarget = '';
|
||||||
|
this.transportMapTarget = '';
|
||||||
|
this.transportMapKeyword = '';
|
||||||
|
this.transportMapStatus = '可搜索地址或点击地图选点';
|
||||||
|
if (this.transportAmapMarker) {
|
||||||
|
this.transportAmapMarker.setMap(null);
|
||||||
|
this.transportAmapMarker = null;
|
||||||
|
}
|
||||||
|
this.$refs.crud?.clearValidate?.([
|
||||||
|
'departureAddress',
|
||||||
|
'arrivalAddress',
|
||||||
|
'departureName',
|
||||||
|
'arrivalName',
|
||||||
|
'departureContact',
|
||||||
|
'departurePhone',
|
||||||
|
'arrivalContact',
|
||||||
|
'arrivalPhone',
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
openTransportPrimaryAddressPicker(target) {
|
openTransportPrimaryAddressPicker(target) {
|
||||||
if (this.transportStationMode) this.openTransportStationDialog(target);
|
if (this.transportStationMode) this.openTransportStationDialog(target);
|
||||||
},
|
},
|
||||||
handleTransportSecondaryAddressInputClick(target) {
|
handleTransportSecondaryAddressInputClick(target) {
|
||||||
if (this.transportStationMode || !this.config.editableRoadAddress)
|
if (this.transportAddressSelectDisabled) return;
|
||||||
this.openTransportSecondaryAddressPicker(target);
|
this.openTransportSecondaryAddressPicker(target);
|
||||||
},
|
},
|
||||||
openTransportSecondaryAddressPicker(target) {
|
openTransportSecondaryAddressPicker(target) {
|
||||||
@@ -3328,6 +3391,13 @@ export default {
|
|||||||
gap: 8px;
|
gap: 8px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
.shipping-template-page__address-map-input {
|
||||||
|
cursor: pointer;
|
||||||
|
:deep(.el-input__wrapper),
|
||||||
|
:deep(.el-input__inner) {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
.shipping-template-page__section-actions {
|
.shipping-template-page__section-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
|||||||
@@ -85,15 +85,23 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #departureAddress="{ row }">
|
<template #departureAddress="{ row }">
|
||||||
<el-tooltip v-if="row.departureAddress" :content="row.departureAddress" placement="top">
|
<el-tooltip
|
||||||
<span>{{ formatTransportPlanProvinceCityDistrict(row.departureAddress) }}</span>
|
v-if="row.departureAddress || row.departureName"
|
||||||
|
:content="row.departureAddress || row.departureName"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<span>{{ formatTransportPlanListAddress(row, 'departure') }}</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #arrivalAddress="{ row }">
|
<template #arrivalAddress="{ row }">
|
||||||
<el-tooltip v-if="row.arrivalAddress" :content="row.arrivalAddress" placement="top">
|
<el-tooltip
|
||||||
<span>{{ formatTransportPlanProvinceCityDistrict(row.arrivalAddress) }}</span>
|
v-if="row.arrivalAddress || row.arrivalName"
|
||||||
|
:content="row.arrivalAddress || row.arrivalName"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<span>{{ formatTransportPlanListAddress(row, 'arrival') }}</span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -574,7 +582,7 @@
|
|||||||
>
|
>
|
||||||
<el-link
|
<el-link
|
||||||
type="primary"
|
type="primary"
|
||||||
v-if="hasPermission(`${config.permission}_view`) && !showDetailButton(row)"
|
v-if="showViewButton(row)"
|
||||||
@click="$refs.crud.rowView(row, index)"
|
@click="$refs.crud.rowView(row, index)"
|
||||||
>
|
>
|
||||||
查看
|
查看
|
||||||
@@ -1492,27 +1500,38 @@
|
|||||||
<el-input
|
<el-input
|
||||||
v-model="dispatchItemForm.departureName"
|
v-model="dispatchItemForm.departureName"
|
||||||
:placeholder="dispatchStationNamePlaceholder"
|
:placeholder="dispatchStationNamePlaceholder"
|
||||||
:suffix-icon="dispatchStationMode ? Search : undefined"
|
:readonly="dispatchStationMode"
|
||||||
disabled
|
@click="openDispatchPrimaryAddressPicker('departure')"
|
||||||
/>
|
>
|
||||||
|
<template v-if="dispatchStationMode" #suffix>
|
||||||
|
<el-icon
|
||||||
|
class="transport-plan-page__map-suffix"
|
||||||
|
@click.stop="openDispatchSecondaryAddressPicker('departure')"
|
||||||
|
>
|
||||||
|
<Search />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="dispatchItemForm.departureAddress"
|
v-model="dispatchItemForm.departureAddress"
|
||||||
:placeholder="dispatchAddressDetailPlaceholder"
|
:placeholder="dispatchAddressDetailPlaceholder"
|
||||||
disabled
|
:readonly="dispatchStationMode"
|
||||||
|
@click="handleDispatchSecondaryAddressInputClick('departure')"
|
||||||
>
|
>
|
||||||
<template v-if="!dispatchStationMode" #suffix>
|
<template v-if="!dispatchStationMode" #suffix>
|
||||||
<el-link
|
<el-link
|
||||||
type="primary"
|
type="primary"
|
||||||
:underline="false"
|
:underline="false"
|
||||||
class="transport-plan-page__address-choose-link"
|
class="transport-plan-page__address-choose-link"
|
||||||
|
@click.stop="openTransportMapDialog('departure')"
|
||||||
>选择</el-link
|
>选择</el-link
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<span class="transport-plan-page__route-label">联系人</span>
|
<span class="transport-plan-page__route-label">联系人</span>
|
||||||
<el-input v-model="dispatchItemForm.departureContact" placeholder="请输入" disabled />
|
<el-input v-model="dispatchItemForm.departureContact" placeholder="请输入" />
|
||||||
<span class="transport-plan-page__route-label">联系方式</span>
|
<span class="transport-plan-page__route-label">联系方式</span>
|
||||||
<el-input v-model="dispatchItemForm.departurePhone" placeholder="请输入" disabled />
|
<el-input v-model="dispatchItemForm.departurePhone" placeholder="请输入" />
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="收货地址" required>
|
<el-form-item label="收货地址" required>
|
||||||
@@ -1520,27 +1539,38 @@
|
|||||||
<el-input
|
<el-input
|
||||||
v-model="dispatchItemForm.arrivalName"
|
v-model="dispatchItemForm.arrivalName"
|
||||||
:placeholder="dispatchStationNamePlaceholder"
|
:placeholder="dispatchStationNamePlaceholder"
|
||||||
:suffix-icon="dispatchStationMode ? Search : undefined"
|
:readonly="dispatchStationMode"
|
||||||
disabled
|
@click="openDispatchPrimaryAddressPicker('arrival')"
|
||||||
/>
|
>
|
||||||
|
<template v-if="dispatchStationMode" #suffix>
|
||||||
|
<el-icon
|
||||||
|
class="transport-plan-page__map-suffix"
|
||||||
|
@click.stop="openDispatchSecondaryAddressPicker('arrival')"
|
||||||
|
>
|
||||||
|
<Search />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="dispatchItemForm.arrivalAddress"
|
v-model="dispatchItemForm.arrivalAddress"
|
||||||
:placeholder="dispatchAddressDetailPlaceholder"
|
:placeholder="dispatchAddressDetailPlaceholder"
|
||||||
disabled
|
:readonly="dispatchStationMode"
|
||||||
|
@click="handleDispatchSecondaryAddressInputClick('arrival')"
|
||||||
>
|
>
|
||||||
<template v-if="!dispatchStationMode" #suffix>
|
<template v-if="!dispatchStationMode" #suffix>
|
||||||
<el-link
|
<el-link
|
||||||
type="primary"
|
type="primary"
|
||||||
:underline="false"
|
:underline="false"
|
||||||
class="transport-plan-page__address-choose-link"
|
class="transport-plan-page__address-choose-link"
|
||||||
|
@click.stop="openTransportMapDialog('arrival')"
|
||||||
>选择</el-link
|
>选择</el-link
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<span class="transport-plan-page__route-label">联系人</span>
|
<span class="transport-plan-page__route-label">联系人</span>
|
||||||
<el-input v-model="dispatchItemForm.arrivalContact" placeholder="请输入" disabled />
|
<el-input v-model="dispatchItemForm.arrivalContact" placeholder="请输入" />
|
||||||
<span class="transport-plan-page__route-label">联系方式</span>
|
<span class="transport-plan-page__route-label">联系方式</span>
|
||||||
<el-input v-model="dispatchItemForm.arrivalPhone" placeholder="请输入" disabled />
|
<el-input v-model="dispatchItemForm.arrivalPhone" placeholder="请输入" />
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
@@ -1576,20 +1606,15 @@
|
|||||||
><span class="transport-plan-page__required-column">货物类型</span></template
|
><span class="transport-plan-page__required-column">货物类型</span></template
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-select
|
<el-autocomplete
|
||||||
v-model="row.cargoType"
|
v-model="row.cargoType"
|
||||||
placeholder="请选择货物类型"
|
placeholder="请输入货物类型"
|
||||||
clearable
|
clearable
|
||||||
filterable
|
:debounce="300"
|
||||||
|
:fetch-suggestions="fetchDispatchConfiguredCargoTypeSuggestions"
|
||||||
|
@select="item => handleDispatchConfiguredCargoTypeSelect(row, item)"
|
||||||
@change="value => handleDispatchConfiguredCargoTypeChange(row, value)"
|
@change="value => handleDispatchConfiguredCargoTypeChange(row, value)"
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in getDispatchConfiguredCargoTypeOptions()"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
/>
|
||||||
</el-select>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column min-width="240" align="center">
|
<el-table-column min-width="240" align="center">
|
||||||
@@ -1597,20 +1622,18 @@
|
|||||||
><span class="transport-plan-page__required-column">货物名称</span></template
|
><span class="transport-plan-page__required-column">货物名称</span></template
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-select
|
<el-autocomplete
|
||||||
v-model="row.cargoName"
|
v-model="row.cargoName"
|
||||||
placeholder="请选择货物名称"
|
placeholder="请输入货物名称"
|
||||||
clearable
|
clearable
|
||||||
filterable
|
:debounce="300"
|
||||||
|
:fetch-suggestions="
|
||||||
|
(queryString, callback) =>
|
||||||
|
fetchDispatchConfiguredCargoNameSuggestions(queryString, callback, row)
|
||||||
|
"
|
||||||
|
@select="item => handleDispatchConfiguredCargoNameSelect(row, item)"
|
||||||
@change="value => handleDispatchConfiguredCargoNameChange(row, value)"
|
@change="value => handleDispatchConfiguredCargoNameChange(row, value)"
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in getDispatchConfiguredCargoNameOptions(row)"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
/>
|
||||||
</el-select>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="包装" min-width="130" align="center">
|
<el-table-column label="包装" min-width="130" align="center">
|
||||||
@@ -1627,7 +1650,11 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="剩余数量" min-width="130" align="center">
|
<el-table-column label="剩余数量" min-width="130" align="center">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ formatDispatchQuantity(dispatchItemRemainingQuantity(row)) }}
|
{{
|
||||||
|
isDispatchPlanQuantityUnlimited(row)
|
||||||
|
? '-'
|
||||||
|
: formatDispatchQuantity(dispatchItemRemainingQuantity(row))
|
||||||
|
}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column min-width="130" align="center">
|
<el-table-column min-width="130" align="center">
|
||||||
@@ -1848,36 +1875,33 @@
|
|||||||
<el-input v-model="dispatchItemForm.escortPhone" placeholder="请输入" />
|
<el-input v-model="dispatchItemForm.escortPhone" placeholder="请输入" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="货物类型" required>
|
<el-form-item label="货物类型" required>
|
||||||
<el-select
|
<el-autocomplete
|
||||||
v-model="dispatchItemForm.cargoType"
|
v-model="dispatchItemForm.cargoType"
|
||||||
placeholder="请选择货物类型"
|
placeholder="请输入货物类型"
|
||||||
clearable
|
clearable
|
||||||
filterable
|
:debounce="300"
|
||||||
@change="handleDispatchConfiguredCargoTypeChange(dispatchItemForm, $event)"
|
:fetch-suggestions="fetchDispatchConfiguredCargoTypeSuggestions"
|
||||||
>
|
@select="item => handleDispatchConfiguredCargoTypeSelect(dispatchItemForm, item)"
|
||||||
<el-option
|
@change="value => handleDispatchConfiguredCargoTypeChange(dispatchItemForm, value)"
|
||||||
v-for="item in getDispatchConfiguredCargoTypeOptions()"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
/>
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="货物名称" required>
|
<el-form-item label="货物名称" required>
|
||||||
<el-select
|
<el-autocomplete
|
||||||
v-model="dispatchItemForm.cargoName"
|
v-model="dispatchItemForm.cargoName"
|
||||||
placeholder="请选择货物名称"
|
placeholder="请输入货物名称"
|
||||||
clearable
|
clearable
|
||||||
filterable
|
:debounce="300"
|
||||||
@change="handleDispatchConfiguredCargoNameChange(dispatchItemForm, $event)"
|
:fetch-suggestions="
|
||||||
>
|
(queryString, callback) =>
|
||||||
<el-option
|
fetchDispatchConfiguredCargoNameSuggestions(
|
||||||
v-for="item in getDispatchConfiguredCargoNameOptions(dispatchItemForm)"
|
queryString,
|
||||||
:key="item.value"
|
callback,
|
||||||
:label="item.label"
|
dispatchItemForm
|
||||||
:value="item.value"
|
)
|
||||||
|
"
|
||||||
|
@select="item => handleDispatchConfiguredCargoNameSelect(dispatchItemForm, item)"
|
||||||
|
@change="value => handleDispatchConfiguredCargoNameChange(dispatchItemForm, value)"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="规格">
|
<el-form-item label="规格">
|
||||||
<el-input v-model="dispatchItemForm.specification" placeholder="请输入" />
|
<el-input v-model="dispatchItemForm.specification" placeholder="请输入" />
|
||||||
@@ -1902,7 +1926,10 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<div class="transport-plan-page__dispatch-quantity-hint">
|
<div
|
||||||
|
v-if="!isDispatchPlanQuantityUnlimited(dispatchItemForm)"
|
||||||
|
class="transport-plan-page__dispatch-quantity-hint"
|
||||||
|
>
|
||||||
剩余数量:{{
|
剩余数量:{{
|
||||||
formatDispatchQuantity(dispatchItemRemainingQuantity(dispatchItemForm))
|
formatDispatchQuantity(dispatchItemRemainingQuantity(dispatchItemForm))
|
||||||
}}
|
}}
|
||||||
@@ -3412,15 +3439,21 @@ export default {
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
dispatchHasAddableQuantity() {
|
dispatchHasAddableQuantity() {
|
||||||
return this.dispatchTableQuantityItems.some(
|
const items = this.dispatchTableQuantityItems;
|
||||||
item => item.total > 0 && item.listed < item.total - 1e-8
|
if (!items.length) return true;
|
||||||
);
|
// 计划总量为 0 时不限制新增调度
|
||||||
|
if (items.every(item => item.total <= 0)) return true;
|
||||||
|
return items.some(item => item.total > 0 && item.listed < item.total - 1e-8);
|
||||||
},
|
},
|
||||||
dispatchSummaryText() {
|
dispatchSummaryText() {
|
||||||
const formatSummary = field =>
|
const formatSummary = field =>
|
||||||
this.dispatchSummaryItems
|
this.dispatchSummaryItems
|
||||||
.map(item => `${this.formatDispatchQuantity(item[field])}${item.unit}`)
|
.map(item => `${this.formatDispatchQuantity(item[field])}${item.unit}`)
|
||||||
.join('、');
|
.join('、');
|
||||||
|
const unlimited = this.dispatchSummaryItems.every(item => item.total <= 0);
|
||||||
|
if (unlimited) {
|
||||||
|
return `已调度 ${formatSummary('assigned') || `0${TRANSPORT_PLAN_QUANTITY_UNIT}`}`;
|
||||||
|
}
|
||||||
return `共${formatSummary('total')} | 已调度 ${formatSummary(
|
return `共${formatSummary('total')} | 已调度 ${formatSummary(
|
||||||
'assigned'
|
'assigned'
|
||||||
)},剩余${formatSummary('remaining')}`;
|
)},剩余${formatSummary('remaining')}`;
|
||||||
@@ -3606,12 +3639,13 @@ export default {
|
|||||||
return ['water', 'rail', 'air'].includes(this.transportMode);
|
return ['water', 'rail', 'air'].includes(this.transportMode);
|
||||||
},
|
},
|
||||||
transportStationTypeLabel() {
|
transportStationTypeLabel() {
|
||||||
|
const mode = this.dispatchItemBox ? this.dispatchTransportMode : this.transportMode;
|
||||||
const labelMap = {
|
const labelMap = {
|
||||||
water: '港口/码头',
|
water: '港口/码头',
|
||||||
rail: '铁路车站',
|
rail: '铁路车站',
|
||||||
air: '空港机场',
|
air: '空港机场',
|
||||||
};
|
};
|
||||||
return labelMap[this.transportMode] || '';
|
return labelMap[mode] || '';
|
||||||
},
|
},
|
||||||
transportStationNamePlaceholder() {
|
transportStationNamePlaceholder() {
|
||||||
if (!this.transportStationMode) return '行政区划自动带出';
|
if (!this.transportStationMode) return '行政区划自动带出';
|
||||||
@@ -3798,6 +3832,37 @@ export default {
|
|||||||
const cityMatch = text.match(/市/);
|
const cityMatch = text.match(/市/);
|
||||||
return cityMatch ? text.slice(0, cityMatch.index + 1) : text;
|
return cityMatch ? text.slice(0, cityMatch.index + 1) : text;
|
||||||
},
|
},
|
||||||
|
formatTransportPlanListAddress(row = {}, field) {
|
||||||
|
const address = String(row[`${field}Address`] || '').trim();
|
||||||
|
const name = String(row[`${field}Name`] || '').trim();
|
||||||
|
const fromAddress = this.extractTransportPlanProvinceCityDistrict(address);
|
||||||
|
if (fromAddress) return fromAddress;
|
||||||
|
const fromName = this.extractTransportPlanProvinceCityDistrict(name);
|
||||||
|
if (fromName) return fromName;
|
||||||
|
return name || address || '-';
|
||||||
|
},
|
||||||
|
extractTransportPlanProvinceCityDistrict(value) {
|
||||||
|
const text = String(value || '')
|
||||||
|
.trim()
|
||||||
|
.replace(/[\\/||、,,\s]+/g, '');
|
||||||
|
if (!text) return '';
|
||||||
|
const districtPattern = '(?:自治县|自治旗|林区|矿区|新区|开发区|区|县|旗)';
|
||||||
|
const parts = [];
|
||||||
|
let remainder = text;
|
||||||
|
const province = text.match(/^(.+?(?:省|自治区|特别行政区))/);
|
||||||
|
if (province) {
|
||||||
|
parts.push(province[1]);
|
||||||
|
remainder = text.slice(province[1].length);
|
||||||
|
}
|
||||||
|
const city = remainder.match(/^(.+?市)/);
|
||||||
|
if (city) {
|
||||||
|
parts.push(city[1]);
|
||||||
|
remainder = remainder.slice(city[1].length);
|
||||||
|
}
|
||||||
|
const district = remainder.match(new RegExp(`^(.+?${districtPattern})`));
|
||||||
|
if (district) parts.push(district[1]);
|
||||||
|
return parts.length ? parts.join('/') : '';
|
||||||
|
},
|
||||||
formatTransportPlanRoadCityDistrict(value) {
|
formatTransportPlanRoadCityDistrict(value) {
|
||||||
const text = String(value || '').trim();
|
const text = String(value || '').trim();
|
||||||
if (!text) return '-';
|
if (!text) return '-';
|
||||||
@@ -3955,6 +4020,11 @@ export default {
|
|||||||
const status = this.statusValue(row);
|
const status = this.statusValue(row);
|
||||||
return status !== 'draft';
|
return status !== 'draft';
|
||||||
},
|
},
|
||||||
|
showViewButton(row) {
|
||||||
|
if (!this.hasPermission(`${this.config.permission}_view`)) return false;
|
||||||
|
if (this.statusValue(row) === 'draft') return false;
|
||||||
|
return !this.showDetailButton(row);
|
||||||
|
},
|
||||||
formatDetailValue(row, prop) {
|
formatDetailValue(row, prop) {
|
||||||
if (!row) return '-';
|
if (!row) return '-';
|
||||||
if (prop === 'businessStatus') return this.displayStatus(row, prop);
|
if (prop === 'businessStatus') return this.displayStatus(row, prop);
|
||||||
@@ -4540,6 +4610,37 @@ export default {
|
|||||||
getDispatchRemainingQuantity(unit) {
|
getDispatchRemainingQuantity(unit) {
|
||||||
return this.getDispatchSummaryItem(unit)?.remaining || 0;
|
return this.getDispatchSummaryItem(unit)?.remaining || 0;
|
||||||
},
|
},
|
||||||
|
/** 计划总量为 0 时不限制调度数量 */
|
||||||
|
isDispatchPlanQuantityUnlimited(row = {}) {
|
||||||
|
const unit = this.getDispatchQuantityUnit(row);
|
||||||
|
const hasCargoIdentity = Boolean(
|
||||||
|
String(row.cargoName || row.goodsName || row.name || '').trim() ||
|
||||||
|
String(row.cargoType || row.secondCargoTypeName || row.goodsType || row.type || '').trim()
|
||||||
|
);
|
||||||
|
const planGoodsRows = this.dispatchPlanGoodsRows;
|
||||||
|
if (planGoodsRows.length && hasCargoIdentity) {
|
||||||
|
const cargoKey = this.getDispatchCargoIdentity(row);
|
||||||
|
const matchedPlanRows = planGoodsRows.filter(
|
||||||
|
goods => this.getDispatchCargoIdentity(goods) === cargoKey
|
||||||
|
);
|
||||||
|
if (!matchedPlanRows.length) {
|
||||||
|
return (this.getDispatchSummaryItem(unit)?.total || 0) <= 0;
|
||||||
|
}
|
||||||
|
const total = matchedPlanRows.reduce(
|
||||||
|
(sum, goods) =>
|
||||||
|
sum +
|
||||||
|
this.parseDispatchQuantity(
|
||||||
|
goods.quantity || goods.cargoQuantity || goods.goodsQuantity
|
||||||
|
),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
return total <= 0;
|
||||||
|
}
|
||||||
|
if (!planGoodsRows.length) {
|
||||||
|
return Number(this.dispatchRow.totalQuantity || this.dispatchRow.quantity || 0) <= 0;
|
||||||
|
}
|
||||||
|
return (this.getDispatchSummaryItem(unit)?.total || 0) <= 0;
|
||||||
|
},
|
||||||
formatDispatchQuantity(value) {
|
formatDispatchQuantity(value) {
|
||||||
const number = Number(value || 0);
|
const number = Number(value || 0);
|
||||||
if (!Number.isFinite(number)) return '0';
|
if (!Number.isFinite(number)) return '0';
|
||||||
@@ -5238,6 +5339,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
ensureTransportTypeBeforeAddress() {
|
ensureTransportTypeBeforeAddress() {
|
||||||
|
if (this.dispatchItemBox) {
|
||||||
|
const transportType =
|
||||||
|
this.dispatchItemForm.transportType || this.dispatchRow?.transportType || '';
|
||||||
|
if (!this.isBillingFieldEmpty(transportType)) return true;
|
||||||
|
this.$message.warning('请先选择运输方式');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!this.shippingInfoFormEnabled || !this.isBillingFieldEmpty(this.form.transportType)) {
|
if (!this.shippingInfoFormEnabled || !this.isBillingFieldEmpty(this.form.transportType)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -5314,19 +5422,21 @@ export default {
|
|||||||
},
|
},
|
||||||
openTransportStationDialog(target) {
|
openTransportStationDialog(target) {
|
||||||
if (!this.ensureTransportTypeBeforeAddress()) return;
|
if (!this.ensureTransportTypeBeforeAddress()) return;
|
||||||
if (!this.transportStationMode) return;
|
const stationMode = this.dispatchItemBox ? this.dispatchStationMode : this.transportStationMode;
|
||||||
|
if (!stationMode) return;
|
||||||
this.transportStationTarget = target;
|
this.transportStationTarget = target;
|
||||||
this.transportStationQuery = {};
|
this.transportStationQuery = {};
|
||||||
this.transportStationPage.currentPage = 1;
|
this.transportStationPage.currentPage = 1;
|
||||||
this.transportStationBox = true;
|
this.transportStationBox = true;
|
||||||
},
|
},
|
||||||
getTransportStationListRequest() {
|
getTransportStationListRequest() {
|
||||||
|
const mode = this.dispatchItemBox ? this.dispatchTransportMode : this.transportMode;
|
||||||
const requestMap = {
|
const requestMap = {
|
||||||
water: getPortTerminalList,
|
water: getPortTerminalList,
|
||||||
rail: getRailwayStationList,
|
rail: getRailwayStationList,
|
||||||
air: getAirportMasterList,
|
air: getAirportMasterList,
|
||||||
};
|
};
|
||||||
return requestMap[this.transportMode];
|
return requestMap[mode];
|
||||||
},
|
},
|
||||||
loadTransportStationList() {
|
loadTransportStationList() {
|
||||||
const request = this.getTransportStationListRequest();
|
const request = this.getTransportStationListRequest();
|
||||||
@@ -5436,7 +5546,28 @@ export default {
|
|||||||
water: '港口/码头',
|
water: '港口/码头',
|
||||||
air: '空港机场',
|
air: '空港机场',
|
||||||
};
|
};
|
||||||
return typeMap[this.transportMode] || '';
|
const mode = this.dispatchItemBox ? this.dispatchTransportMode : this.transportMode;
|
||||||
|
return typeMap[mode] || '';
|
||||||
|
},
|
||||||
|
getTransportAddressForm() {
|
||||||
|
return this.dispatchItemBox ? this.dispatchItemForm : this.form;
|
||||||
|
},
|
||||||
|
openDispatchPrimaryAddressPicker(target) {
|
||||||
|
if (this.dispatchStationMode) {
|
||||||
|
this.openTransportStationDialog(target);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
openDispatchSecondaryAddressPicker(target) {
|
||||||
|
if (this.dispatchStationMode) {
|
||||||
|
this.openTransportStationDialog(target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.openTransportMapDialog(target);
|
||||||
|
},
|
||||||
|
handleDispatchSecondaryAddressInputClick(target) {
|
||||||
|
if (this.dispatchStationMode) {
|
||||||
|
this.openDispatchSecondaryAddressPicker(target);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
loadTransportAddressList() {
|
loadTransportAddressList() {
|
||||||
this.transportAddressLoading = true;
|
this.transportAddressLoading = true;
|
||||||
@@ -5487,35 +5618,39 @@ export default {
|
|||||||
},
|
},
|
||||||
applyTransportAddress(target, address = {}) {
|
applyTransportAddress(target, address = {}) {
|
||||||
const prefix = target === 'departure' ? 'departure' : 'arrival';
|
const prefix = target === 'departure' ? 'departure' : 'arrival';
|
||||||
this.form[`${prefix}Name`] = address.preferRegionName
|
const addressForm = this.getTransportAddressForm();
|
||||||
|
addressForm[`${prefix}Name`] = address.preferRegionName
|
||||||
? address.regionName || address.addressName || ''
|
? address.regionName || address.addressName || ''
|
||||||
: address.addressName || address.regionName || '';
|
: address.addressName || address.regionName || '';
|
||||||
this.form[`${prefix}Address`] = address.detailAddress || address.address || '';
|
addressForm[`${prefix}Address`] = address.detailAddress || address.address || '';
|
||||||
this.form[`${prefix}AddressCode`] = address.addressCode || '';
|
addressForm[`${prefix}AddressCode`] = address.addressCode || '';
|
||||||
this.form[`${prefix}SiteCode`] =
|
addressForm[`${prefix}SiteCode`] =
|
||||||
address.addressType === '常规地址'
|
address.addressType === '常规地址'
|
||||||
? '/'
|
? '/'
|
||||||
: address.siteCodeDisplay || address.siteCode || '';
|
: address.siteCodeDisplay || address.siteCode || '';
|
||||||
this.form[`${prefix}Longitude`] = address.longitude || '';
|
addressForm[`${prefix}Longitude`] = address.longitude || '';
|
||||||
this.form[`${prefix}Latitude`] = address.latitude || '';
|
addressForm[`${prefix}Latitude`] = address.latitude || '';
|
||||||
this.form[`${prefix}Contact`] = address.contactName || this.form[`${prefix}Contact`] || '';
|
addressForm[`${prefix}Contact`] =
|
||||||
this.form[`${prefix}Phone`] = address.contactPhone || this.form[`${prefix}Phone`] || '';
|
address.contactName || addressForm[`${prefix}Contact`] || '';
|
||||||
|
addressForm[`${prefix}Phone`] = address.contactPhone || addressForm[`${prefix}Phone`] || '';
|
||||||
// 地址值在本轮响应式更新后再清理校验状态,避免 Avue 以旧空值重新触发必填提示。
|
// 地址值在本轮响应式更新后再清理校验状态,避免 Avue 以旧空值重新触发必填提示。
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.crud?.clearValidate?.([`${prefix}Address`]);
|
this.$refs.crud?.clearValidate?.([`${prefix}Address`]);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
openTransportMapDialog(target) {
|
openTransportMapDialog(target) {
|
||||||
if (this.dialogReadonly) return;
|
if (this.dialogReadonly && !this.dispatchItemBox) return;
|
||||||
if (!this.ensureTransportTypeBeforeAddress()) return;
|
if (!this.ensureTransportTypeBeforeAddress()) return;
|
||||||
const prefix = target === 'departure' ? 'departure' : 'arrival';
|
const prefix = target === 'departure' ? 'departure' : 'arrival';
|
||||||
|
const addressForm = this.getTransportAddressForm();
|
||||||
this.transportMapTarget = prefix;
|
this.transportMapTarget = prefix;
|
||||||
this.transportMapKeyword = this.form[`${prefix}Address`] || this.form[`${prefix}Name`] || '';
|
this.transportMapKeyword =
|
||||||
|
addressForm[`${prefix}Address`] || addressForm[`${prefix}Name`] || '';
|
||||||
this.transportMapSelected = this.buildTransportMapSelection({
|
this.transportMapSelected = this.buildTransportMapSelection({
|
||||||
lng: this.form[`${prefix}Longitude`],
|
lng: addressForm[`${prefix}Longitude`],
|
||||||
lat: this.form[`${prefix}Latitude`],
|
lat: addressForm[`${prefix}Latitude`],
|
||||||
address: this.form[`${prefix}Address`],
|
address: addressForm[`${prefix}Address`],
|
||||||
regionName: this.form[`${prefix}Name`],
|
regionName: addressForm[`${prefix}Name`],
|
||||||
});
|
});
|
||||||
this.transportMapStatus = this.transportMapSelected.longitude
|
this.transportMapStatus = this.transportMapSelected.longitude
|
||||||
? '已加载当前选点,可重新选点'
|
? '已加载当前选点,可重新选点'
|
||||||
@@ -5673,12 +5808,13 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const prefix = this.transportMapTarget;
|
const prefix = this.transportMapTarget;
|
||||||
this.form[`${prefix}Address`] =
|
const addressForm = this.getTransportAddressForm();
|
||||||
this.transportMapSelected.detailAddress || this.form[`${prefix}Address`];
|
addressForm[`${prefix}Address`] =
|
||||||
this.form[`${prefix}Name`] =
|
this.transportMapSelected.detailAddress || addressForm[`${prefix}Address`];
|
||||||
this.transportMapSelected.regionName || this.form[`${prefix}Name`];
|
addressForm[`${prefix}Name`] =
|
||||||
this.form[`${prefix}Longitude`] = this.transportMapSelected.longitude;
|
this.transportMapSelected.regionName || addressForm[`${prefix}Name`];
|
||||||
this.form[`${prefix}Latitude`] = this.transportMapSelected.latitude;
|
addressForm[`${prefix}Longitude`] = this.transportMapSelected.longitude;
|
||||||
|
addressForm[`${prefix}Latitude`] = this.transportMapSelected.latitude;
|
||||||
this.transportMapBox = false;
|
this.transportMapBox = false;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.crud?.clearValidate?.([`${prefix}Address`]);
|
this.$refs.crud?.clearValidate?.([`${prefix}Address`]);
|
||||||
@@ -7287,8 +7423,9 @@ export default {
|
|||||||
item.cargoTypePath.join('/') === rowTypePath.join('/')
|
item.cargoTypePath.join('/') === rowTypePath.join('/')
|
||||||
)
|
)
|
||||||
: goodsOptions;
|
: goodsOptions;
|
||||||
|
const source = filtered.length ? filtered : goodsOptions;
|
||||||
const options = new Map();
|
const options = new Map();
|
||||||
filtered.forEach(item => {
|
source.forEach(item => {
|
||||||
if (!item.cargoName || options.has(item.cargoName)) return;
|
if (!item.cargoName || options.has(item.cargoName)) return;
|
||||||
options.set(item.cargoName, {
|
options.set(item.cargoName, {
|
||||||
label: item.cargoName,
|
label: item.cargoName,
|
||||||
@@ -7302,26 +7439,73 @@ export default {
|
|||||||
});
|
});
|
||||||
return Array.from(options.values());
|
return Array.from(options.values());
|
||||||
},
|
},
|
||||||
handleDispatchConfiguredCargoTypeChange(row, value) {
|
fetchDispatchConfiguredCargoTypeSuggestions(queryString, callback) {
|
||||||
const option = this.getDispatchConfiguredCargoTypeOptions().find(
|
const keyword = String(queryString || '').trim().toLowerCase();
|
||||||
item => String(item.value) === String(value || '')
|
const options = this.getDispatchConfiguredCargoTypeOptions().map(item => ({
|
||||||
|
...item,
|
||||||
|
value: item.label,
|
||||||
|
}));
|
||||||
|
callback(
|
||||||
|
keyword
|
||||||
|
? options.filter(item => String(item.value).toLowerCase().includes(keyword))
|
||||||
|
: options
|
||||||
);
|
);
|
||||||
row.cargoType = option?.label || '';
|
},
|
||||||
row.cargoTypeCode = option?.cargoTypeCode || '';
|
fetchDispatchConfiguredCargoNameSuggestions(queryString, callback, row = {}) {
|
||||||
row.cargoTypePath = option?.cargoTypePath || [];
|
const keyword = String(queryString || '').trim().toLowerCase();
|
||||||
|
const options = this.getDispatchConfiguredCargoNameOptions(row).map(item => ({
|
||||||
|
...item,
|
||||||
|
value: item.label,
|
||||||
|
}));
|
||||||
|
callback(
|
||||||
|
keyword
|
||||||
|
? options.filter(item => String(item.value).toLowerCase().includes(keyword))
|
||||||
|
: options
|
||||||
|
);
|
||||||
|
},
|
||||||
|
handleDispatchConfiguredCargoTypeSelect(row, item = {}) {
|
||||||
|
this.handleDispatchConfiguredCargoTypeChange(row, item.value || item.label || '');
|
||||||
|
},
|
||||||
|
handleDispatchConfiguredCargoNameSelect(row, item = {}) {
|
||||||
|
this.handleDispatchConfiguredCargoNameChange(row, item.value || item.label || '');
|
||||||
|
},
|
||||||
|
handleDispatchConfiguredCargoTypeChange(row, value) {
|
||||||
|
const nextValue = String(value ?? row.cargoType ?? '').trim();
|
||||||
|
const option = this.getDispatchConfiguredCargoTypeOptions().find(
|
||||||
|
item => String(item.value) === nextValue || item.label === nextValue
|
||||||
|
);
|
||||||
|
if (option) {
|
||||||
|
row.cargoType = option.label || '';
|
||||||
|
row.cargoTypeCode = option.cargoTypeCode || '';
|
||||||
|
row.cargoTypePath = option.cargoTypePath || [];
|
||||||
|
} else {
|
||||||
|
row.cargoType = nextValue;
|
||||||
|
row.cargoTypeCode = '';
|
||||||
|
row.cargoTypePath = [];
|
||||||
|
}
|
||||||
row.cargoName = '';
|
row.cargoName = '';
|
||||||
row.specification = '';
|
row.specification = '';
|
||||||
row.model = '';
|
row.model = '';
|
||||||
},
|
},
|
||||||
handleDispatchConfiguredCargoNameChange(row, value) {
|
handleDispatchConfiguredCargoNameChange(row, value) {
|
||||||
|
const nextValue = String(value ?? row.cargoName ?? '').trim();
|
||||||
const option = this.getDispatchConfiguredCargoNameOptions(row).find(
|
const option = this.getDispatchConfiguredCargoNameOptions(row).find(
|
||||||
item => String(item.value) === String(value || '')
|
item => String(item.value) === nextValue || item.label === nextValue
|
||||||
);
|
);
|
||||||
row.cargoName = option?.value || '';
|
if (!option) {
|
||||||
if (!option) return;
|
row.cargoName = nextValue;
|
||||||
row.cargoType = option.cargoTypeLabel || row.cargoType || '';
|
return;
|
||||||
|
}
|
||||||
|
const previousType = String(row.cargoType || '').trim();
|
||||||
|
const isKnownType = this.getDispatchConfiguredCargoTypeOptions().some(
|
||||||
|
item => item.label === previousType || String(item.value) === previousType
|
||||||
|
);
|
||||||
|
row.cargoName = option.value || '';
|
||||||
|
if (!previousType || isKnownType) {
|
||||||
|
row.cargoType = option.cargoTypeLabel || previousType;
|
||||||
row.cargoTypeCode = option.cargoTypeCode || row.cargoTypeCode || '';
|
row.cargoTypeCode = option.cargoTypeCode || row.cargoTypeCode || '';
|
||||||
row.cargoTypePath = option.cargoTypePath || row.cargoTypePath || [];
|
row.cargoTypePath = option.cargoTypePath || row.cargoTypePath || [];
|
||||||
|
}
|
||||||
row.specification = option.specification || row.specification || '';
|
row.specification = option.specification || row.specification || '';
|
||||||
row.model = option.model || row.model || '';
|
row.model = option.model || row.model || '';
|
||||||
},
|
},
|
||||||
@@ -7345,10 +7529,7 @@ export default {
|
|||||||
vehicleNo: this.dispatchRow.vehicleNo || '',
|
vehicleNo: this.dispatchRow.vehicleNo || '',
|
||||||
cargoName: defaultGoods.cargoName || this.dispatchRow.cargoName || '',
|
cargoName: defaultGoods.cargoName || this.dispatchRow.cargoName || '',
|
||||||
cargoType: defaultGoods.cargoType || this.dispatchRow.cargoType || '',
|
cargoType: defaultGoods.cargoType || this.dispatchRow.cargoType || '',
|
||||||
quantity:
|
quantity: '',
|
||||||
index >= 0
|
|
||||||
? defaultGoods.quantity || ''
|
|
||||||
: this.formatDispatchQuantity(this.getDispatchRemainingQuantity(defaultUnit)),
|
|
||||||
quantityUnit: defaultUnit,
|
quantityUnit: defaultUnit,
|
||||||
specification: defaultGoods.specification || '',
|
specification: defaultGoods.specification || '',
|
||||||
model: defaultGoods.model || '',
|
model: defaultGoods.model || '',
|
||||||
@@ -8003,6 +8184,7 @@ export default {
|
|||||||
quantityGroups.set(key, group);
|
quantityGroups.set(key, group);
|
||||||
});
|
});
|
||||||
for (const { row: goods, quantity } of quantityGroups.values()) {
|
for (const { row: goods, quantity } of quantityGroups.values()) {
|
||||||
|
if (this.isDispatchPlanQuantityUnlimited(goods)) continue;
|
||||||
const unit = this.getDispatchQuantityUnit(goods);
|
const unit = this.getDispatchQuantityUnit(goods);
|
||||||
const remaining = this.dispatchItemRemainingQuantity(goods);
|
const remaining = this.dispatchItemRemainingQuantity(goods);
|
||||||
if (quantity - remaining > 1e-8) {
|
if (quantity - remaining > 1e-8) {
|
||||||
|
|||||||
@@ -5177,15 +5177,28 @@ export default {
|
|||||||
delete sourceData.code;
|
delete sourceData.code;
|
||||||
delete sourceData.waybillNo;
|
delete sourceData.waybillNo;
|
||||||
delete sourceData.waybillStatus;
|
delete sourceData.waybillStatus;
|
||||||
|
delete sourceData.businessStatus;
|
||||||
|
delete sourceData.businessStatusName;
|
||||||
|
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 = '手工创建';
|
||||||
|
this.form.businessStatus = '';
|
||||||
|
this.form.businessStatusName = '';
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -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="action.type === 'delete' ? 'danger' : 'primary'"
|
:type="['delete', 'cancel'].includes(action.type) ? 'danger' : 'primary'"
|
||||||
@click="handleRowAction(action.type, row)"
|
@click="handleRowAction(action.type, row)"
|
||||||
>{{ action.label }}</el-link
|
>{{ action.label }}</el-link
|
||||||
>
|
>
|
||||||
@@ -1677,7 +1677,6 @@ export default {
|
|||||||
add: '新建配载',
|
add: '新建配载',
|
||||||
edit: '编辑配载单',
|
edit: '编辑配载单',
|
||||||
view: '配载单详情',
|
view: '配载单详情',
|
||||||
copy: '复制配载单',
|
|
||||||
reassign: '重新派单',
|
reassign: '重新派单',
|
||||||
};
|
};
|
||||||
return titleMap[this.dialogMode] || '配载管理';
|
return titleMap[this.dialogMode] || '配载管理';
|
||||||
@@ -2014,31 +2013,28 @@ 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') {
|
||||||
return [
|
const actions = [
|
||||||
{ type: 'view', label: '详情' },
|
{ type: 'view', label: '详情' },
|
||||||
{ type: 'reassign', label: '重新派单' },
|
{ type: 'start', 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 [
|
return [{ type: 'view', label: '详情' }];
|
||||||
{ type: 'view', label: '详情' },
|
|
||||||
{ type: 'copy', label: '复制' },
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
return [{ type: 'view', label: '详情' }];
|
return [{ type: 'view', label: '详情' }];
|
||||||
},
|
},
|
||||||
@@ -2047,8 +2043,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),
|
||||||
};
|
};
|
||||||
@@ -2784,16 +2780,6 @@ 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 () => {
|
||||||
@@ -2813,6 +2799,15 @@ 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 () => {
|
||||||
|
|||||||
+209
-105
@@ -1,57 +1,58 @@
|
|||||||
<template>
|
<template>
|
||||||
<basic-container class="master-order-page">
|
<basic-container class="master-order-page">
|
||||||
<template v-if="mode === 'list'">
|
<template v-if="mode === 'list'">
|
||||||
<el-form :model="query" class="master-search" label-width="160px" @submit.prevent>
|
<div class="master-order-page__search">
|
||||||
<el-row :gutter="16">
|
<el-form :model="query" label-position="right" label-width="88px" @submit.prevent>
|
||||||
<el-col v-for="field in primaryFields" :key="field.prop" :span="6"
|
<div class="master-order-page__search-grid">
|
||||||
><el-form-item :label="field.label"
|
<el-form-item v-for="field in primaryFields" :key="field.prop" :label="field.label">
|
||||||
><el-input v-model="query[field.prop]" placeholder="请输入" /></el-form-item
|
<el-input v-model="query[field.prop]" clearable placeholder="请输入" />
|
||||||
></el-col>
|
</el-form-item>
|
||||||
<el-col :span="6"
|
<el-form-item label="状态">
|
||||||
><el-form-item label="状态"
|
<el-select v-model="query.businessStatus" clearable placeholder="全部">
|
||||||
><el-select v-model="query.businessStatus" placeholder="全部"
|
<el-option label="全部" value="" />
|
||||||
><el-option label="全部" value="" /><el-option
|
<el-option
|
||||||
v-for="item in statuses"
|
v-for="item in statuses"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value" /></el-select></el-form-item
|
:value="item.value"
|
||||||
></el-col>
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
<template v-if="searchExpanded">
|
<template v-if="searchExpanded">
|
||||||
<el-col v-for="field in secondaryFields" :key="field.prop" :span="6"
|
<el-form-item v-for="field in secondaryFields" :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-date-picker
|
||||||
><el-form-item label="计划开始日期"
|
|
||||||
><el-date-picker
|
|
||||||
v-model="query.planStartRange"
|
v-model="query.planStartRange"
|
||||||
type="datetimerange"
|
type="datetimerange"
|
||||||
format="YYYY-MM-DD HH:mm"
|
format="YYYY-MM-DD HH:mm"
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
start-placeholder="请选择"
|
start-placeholder="请选择"
|
||||||
end-placeholder="请选择" /></el-form-item
|
end-placeholder="请选择"
|
||||||
></el-col>
|
/>
|
||||||
<el-col :span="6"
|
</el-form-item>
|
||||||
><el-form-item label="计划结束日期"
|
<el-form-item label="计划结束日期">
|
||||||
><el-date-picker
|
<el-date-picker
|
||||||
v-model="query.planEndRange"
|
v-model="query.planEndRange"
|
||||||
type="datetimerange"
|
type="datetimerange"
|
||||||
format="YYYY-MM-DD HH:mm"
|
format="YYYY-MM-DD HH:mm"
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
start-placeholder="请选择"
|
start-placeholder="请选择"
|
||||||
end-placeholder="请选择" /></el-form-item
|
end-placeholder="请选择"
|
||||||
></el-col>
|
/>
|
||||||
|
</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
|
||||||
@@ -76,7 +77,13 @@
|
|||||||
<div class="route-point">
|
<div class="route-point">
|
||||||
<span :class="['route-node', node.type]">{{ node.text }}</span>
|
<span :class="['route-node', node.type]">{{ node.text }}</span>
|
||||||
<div class="route-detail">
|
<div class="route-detail">
|
||||||
<el-tooltip placement="top"><template #content>{{ node.name }}</template><strong>{{ node.name }}</strong></el-tooltip>
|
<el-tooltip
|
||||||
|
:content="node.address || node.name || '-'"
|
||||||
|
placement="top"
|
||||||
|
:show-after="120"
|
||||||
|
>
|
||||||
|
<strong>{{ node.name }}</strong>
|
||||||
|
</el-tooltip>
|
||||||
<span v-for="line in node.lines" :key="line">{{ line }}</span>
|
<span v-for="line in node.lines" :key="line">{{ line }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -125,7 +132,7 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<master-order-dispatch v-else-if="mode === 'dispatch'" :id="routeId" @back="goList" />
|
<master-order-dispatch v-else-if="mode === 'dispatch'" :id="routeId" @back="goList" />
|
||||||
<master-order-detail v-else :id="routeId" @back="goList" />
|
<master-order-detail v-else :id="routeId" />
|
||||||
<el-dialog v-model="confirm.visible" title="提示" width="400px"
|
<el-dialog v-model="confirm.visible" title="提示" width="400px"
|
||||||
><span>{{ confirm.message }}</span
|
><span>{{ confirm.message }}</span
|
||||||
><template #footer
|
><template #footer
|
||||||
@@ -138,7 +145,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as api from '@/api/business/master-order';
|
import * as api from '@/api/business/master-order';
|
||||||
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue';
|
|
||||||
import MasterOrderEditor from './components/master-order-editor.vue';
|
import MasterOrderEditor from './components/master-order-editor.vue';
|
||||||
import MasterOrderDispatch from './components/master-order-dispatch.vue';
|
import MasterOrderDispatch from './components/master-order-dispatch.vue';
|
||||||
import MasterOrderDetail from './components/master-order-detail.vue';
|
import MasterOrderDetail from './components/master-order-detail.vue';
|
||||||
@@ -147,8 +153,6 @@ 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: [],
|
||||||
@@ -303,7 +307,7 @@ export default {
|
|||||||
},
|
},
|
||||||
timeRange(row) {
|
timeRange(row) {
|
||||||
return row.planStartTime && row.planEndTime
|
return row.planStartTime && row.planEndTime
|
||||||
? `${String(row.planStartTime).slice(0, 16)} - ${String(row.planEndTime).slice(0, 16)}`
|
? `${String(row.planStartTime).slice(0, 10)} - ${String(row.planEndTime).slice(0, 10)}`
|
||||||
: '-';
|
: '-';
|
||||||
},
|
},
|
||||||
goodsSummary(row) {
|
goodsSummary(row) {
|
||||||
@@ -334,6 +338,19 @@ export default {
|
|||||||
const value = String(type || '').trim().toLowerCase();
|
const value = String(type || '').trim().toLowerCase();
|
||||||
return value === 'road' || value.includes('公路');
|
return value === 'road' || value.includes('公路');
|
||||||
},
|
},
|
||||||
|
isStationLikeName(value) {
|
||||||
|
const text = String(value || '').trim();
|
||||||
|
if (!text) return false;
|
||||||
|
return /(?:火车站|高铁站|客运站|货运站|港口|码头|机场|空港|航站楼)$/.test(text) || /(?<!市|州|盟|区|县|旗)站$/.test(text);
|
||||||
|
},
|
||||||
|
isNonRoadLocation({ name, siteCode, transportType, nextTransportType } = {}) {
|
||||||
|
const code = String(siteCode || '').trim();
|
||||||
|
if (code && code !== '/') return true;
|
||||||
|
if (this.isStationLikeName(name)) return true;
|
||||||
|
if (transportType && !this.isRoadTransportType(transportType)) return true;
|
||||||
|
if (nextTransportType && !this.isRoadTransportType(nextTransportType)) return true;
|
||||||
|
return false;
|
||||||
|
},
|
||||||
formatRoadAddress(value) {
|
formatRoadAddress(value) {
|
||||||
const text = String(value || '').replace(/\s+/g, '');
|
const text = String(value || '').replace(/\s+/g, '');
|
||||||
if (!text) return '-';
|
if (!text) return '-';
|
||||||
@@ -355,10 +372,16 @@ export default {
|
|||||||
routeNodeName(value, address, transportType, region = {}) {
|
routeNodeName(value, address, transportType, region = {}) {
|
||||||
const text = String(value || '').trim();
|
const text = String(value || '').trim();
|
||||||
if (!text) return '-';
|
if (!text) return '-';
|
||||||
const siteCode = String(region.siteCode || '').trim();
|
if (
|
||||||
// 运输方式切换不应改变地址本身的展示模式:有站点编码时显示站点名称,
|
this.isNonRoadLocation({
|
||||||
// 没有站点编码的区域地址统一按“市 区县”格式展示。
|
name: text,
|
||||||
if (siteCode && siteCode !== '/') return text;
|
siteCode: region.siteCode,
|
||||||
|
transportType,
|
||||||
|
nextTransportType: region.nextTransportType,
|
||||||
|
})
|
||||||
|
) {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
// 优先从完整的地址名称/详细地址解析,避免后端只返回“梅州”等不完整的市名称时
|
// 优先从完整的地址名称/详细地址解析,避免后端只返回“梅州”等不完整的市名称时
|
||||||
// 提前返回城市,导致区县被遗漏。
|
// 提前返回城市,导致区县被遗漏。
|
||||||
const parsedText = this.formatRoadAddress(text);
|
const parsedText = this.formatRoadAddress(text);
|
||||||
@@ -383,86 +406,149 @@ export default {
|
|||||||
const source = /省|自治区|特别行政区|市|州|盟/.test(text) ? text : address || text;
|
const source = /省|自治区|特别行政区|市|州|盟/.test(text) ? text : address || text;
|
||||||
const formatted = this.formatRoadAddress(source);
|
const formatted = this.formatRoadAddress(source);
|
||||||
if (/(?:区|县|旗)$/.test(text) && !formatted.includes(text)) {
|
if (/(?:区|县|旗)$/.test(text) && !formatted.includes(text)) {
|
||||||
const city = formatted.split(' ')[0];
|
const cityName = formatted.split(' ')[0];
|
||||||
return city && city !== formatted ? `${city} ${text}` : formatted;
|
return cityName && cityName !== formatted ? `${cityName} ${text}` : formatted;
|
||||||
}
|
}
|
||||||
return formatted;
|
return formatted;
|
||||||
},
|
},
|
||||||
|
resolveRouteNodeLocation({
|
||||||
|
name,
|
||||||
|
address,
|
||||||
|
transportType,
|
||||||
|
nextTransportType,
|
||||||
|
cityName,
|
||||||
|
districtName,
|
||||||
|
siteCode,
|
||||||
|
} = {}) {
|
||||||
|
const rawName = String(name || '').trim();
|
||||||
|
const rawAddress = String(address || '').trim();
|
||||||
|
const regionText = [cityName, districtName].filter(Boolean).join(' ');
|
||||||
|
const nonRoad = this.isNonRoadLocation({
|
||||||
|
name: rawName,
|
||||||
|
siteCode,
|
||||||
|
transportType,
|
||||||
|
nextTransportType,
|
||||||
|
});
|
||||||
|
if (nonRoad) {
|
||||||
|
// 非公路:展示站点名称,悬停展示详细地址。
|
||||||
|
// 兼容历史数据把站点名称写在 address、区域信息写在 name 的情况。
|
||||||
|
if (this.isStationLikeName(rawAddress) && !this.isStationLikeName(rawName)) {
|
||||||
|
return {
|
||||||
|
name: rawAddress,
|
||||||
|
address: rawName || regionText || rawAddress,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const displayName = rawName || rawAddress || '-';
|
||||||
|
const tipAddress =
|
||||||
|
(rawAddress && rawAddress !== displayName ? rawAddress : '') ||
|
||||||
|
regionText ||
|
||||||
|
rawAddress ||
|
||||||
|
displayName;
|
||||||
|
return { name: displayName, address: tipAddress };
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
name: this.routeNodeName(rawName || rawAddress, rawAddress, transportType, {
|
||||||
|
cityName,
|
||||||
|
districtName,
|
||||||
|
siteCode,
|
||||||
|
nextTransportType,
|
||||||
|
}),
|
||||||
|
address: rawAddress || rawName || regionText || '-',
|
||||||
|
};
|
||||||
|
},
|
||||||
routeNodes(row = {}) {
|
routeNodes(row = {}) {
|
||||||
const routes = row.routeProgress || [];
|
const routes = row.routeProgress || [];
|
||||||
const total = this.routeNumber(row.totalQuantity);
|
const total = this.routeNumber(row.totalQuantity);
|
||||||
const firstTransportType = routes[0]?.transportType || row.routes?.[0]?.transportType || row.transportType || '';
|
const firstTransportType = routes[0]?.transportType || row.routes?.[0]?.transportType || row.transportType || '';
|
||||||
if (!routes.length) {
|
if (!routes.length) {
|
||||||
|
const start = this.resolveRouteNodeLocation({
|
||||||
|
name: row.departureName || row.departureAddress,
|
||||||
|
address: row.departureAddress,
|
||||||
|
transportType: firstTransportType,
|
||||||
|
cityName: row.departureCityName,
|
||||||
|
districtName: row.departureDistrictName,
|
||||||
|
siteCode: row.departureSiteCode,
|
||||||
|
});
|
||||||
|
const end = this.resolveRouteNodeLocation({
|
||||||
|
name: row.arrivalName || row.arrivalAddress,
|
||||||
|
address: row.arrivalAddress,
|
||||||
|
transportType: row.finalTransportType || firstTransportType,
|
||||||
|
cityName: row.arrivalCityName,
|
||||||
|
districtName: row.arrivalDistrictName,
|
||||||
|
siteCode: row.arrivalSiteCode,
|
||||||
|
});
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
key: 'start',
|
key: 'start',
|
||||||
type: 'start',
|
type: 'start',
|
||||||
text: '起',
|
text: '起',
|
||||||
name: this.routeNodeName(
|
...start,
|
||||||
row.departureName || row.departureAddress,
|
|
||||||
row.departureAddress,
|
|
||||||
firstTransportType,
|
|
||||||
{
|
|
||||||
cityName: row.departureCityName,
|
|
||||||
districtName: row.departureDistrictName,
|
|
||||||
siteCode: row.departureSiteCode,
|
|
||||||
}
|
|
||||||
),
|
|
||||||
lines: [`已调度0/${total}吨`],
|
lines: [`已调度0/${total}吨`],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'end',
|
key: 'end',
|
||||||
type: 'end',
|
type: 'end',
|
||||||
text: '终',
|
text: '终',
|
||||||
name: this.routeNodeName(
|
...end,
|
||||||
row.arrivalName || row.arrivalAddress,
|
|
||||||
row.arrivalAddress,
|
|
||||||
row.finalTransportType || firstTransportType,
|
|
||||||
{
|
|
||||||
cityName: row.arrivalCityName,
|
|
||||||
districtName: row.arrivalDistrictName,
|
|
||||||
siteCode: row.arrivalSiteCode,
|
|
||||||
}
|
|
||||||
),
|
|
||||||
lines: [`到达0/${total}吨`],
|
lines: [`到达0/${total}吨`],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
const start = this.resolveRouteNodeLocation({
|
||||||
|
name: row.departureName || row.departureAddress,
|
||||||
|
address: row.departureAddress,
|
||||||
|
transportType: firstTransportType,
|
||||||
|
nextTransportType: firstTransportType,
|
||||||
|
cityName: row.departureCityName,
|
||||||
|
districtName: row.departureDistrictName,
|
||||||
|
siteCode: row.departureSiteCode,
|
||||||
|
});
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
key: 'start',
|
key: 'start',
|
||||||
type: 'start',
|
type: 'start',
|
||||||
text: '起',
|
text: '起',
|
||||||
name: this.routeNodeName(
|
...start,
|
||||||
row.departureName || row.departureAddress,
|
|
||||||
row.departureAddress,
|
|
||||||
firstTransportType,
|
|
||||||
{
|
|
||||||
cityName: row.departureCityName,
|
|
||||||
districtName: row.departureDistrictName,
|
|
||||||
siteCode: row.departureSiteCode,
|
|
||||||
}
|
|
||||||
),
|
|
||||||
lines: [`已调度${this.routeNumber(routes[0]?.dispatchedQuantity)}/${total}吨`],
|
lines: [`已调度${this.routeNumber(routes[0]?.dispatchedQuantity)}/${total}吨`],
|
||||||
},
|
},
|
||||||
...routes.map((route, index) => {
|
...routes.map((route, index) => {
|
||||||
const isEnd = index === routes.length - 1;
|
const isEnd = index === routes.length - 1;
|
||||||
const arrived = this.routeNumber(this.routeArrivedQuantity(route));
|
const arrived = this.routeNumber(this.routeArrivedQuantity(route));
|
||||||
const dispatched = this.routeNumber(routes[index + 1]?.dispatchedQuantity);
|
const dispatched = this.routeNumber(routes[index + 1]?.dispatchedQuantity);
|
||||||
|
const address =
|
||||||
|
route.arrivalAddress ||
|
||||||
|
route.departureAddress ||
|
||||||
|
(isEnd ? row.arrivalAddress : '') ||
|
||||||
|
'';
|
||||||
|
const location = this.resolveRouteNodeLocation({
|
||||||
|
name:
|
||||||
|
route.arrivalName ||
|
||||||
|
route.departureName ||
|
||||||
|
(isEnd ? row.arrivalName : '') ||
|
||||||
|
'',
|
||||||
|
address,
|
||||||
|
transportType: route.transportType,
|
||||||
|
nextTransportType: isEnd
|
||||||
|
? row.finalTransportType || route.transportType
|
||||||
|
: routes[index + 1]?.transportType || '',
|
||||||
|
cityName:
|
||||||
|
route.arrivalCityName ||
|
||||||
|
route.departureCityName ||
|
||||||
|
(isEnd ? row.arrivalCityName : ''),
|
||||||
|
districtName:
|
||||||
|
route.arrivalDistrictName ||
|
||||||
|
route.departureDistrictName ||
|
||||||
|
(isEnd ? row.arrivalDistrictName : ''),
|
||||||
|
siteCode:
|
||||||
|
route.arrivalSiteCode ||
|
||||||
|
route.departureSiteCode ||
|
||||||
|
(isEnd ? row.arrivalSiteCode : ''),
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
key: route.segmentNo || `route-${index}`,
|
key: route.segmentNo || `route-${index}`,
|
||||||
type: isEnd ? 'end' : 'middle',
|
type: isEnd ? 'end' : 'middle',
|
||||||
text: isEnd ? '终' : '经',
|
text: isEnd ? '终' : '经',
|
||||||
name: this.routeNodeName(
|
...location,
|
||||||
route.arrivalName || route.departureName || row.arrivalName,
|
|
||||||
route.arrivalAddress || route.departureAddress,
|
|
||||||
route.transportType,
|
|
||||||
{
|
|
||||||
cityName: route.arrivalCityName || route.departureCityName,
|
|
||||||
districtName: route.arrivalDistrictName || route.departureDistrictName,
|
|
||||||
siteCode: route.arrivalSiteCode || route.departureSiteCode,
|
|
||||||
}
|
|
||||||
),
|
|
||||||
lines: isEnd
|
lines: isEnd
|
||||||
? [`到达${arrived}/${total}吨`]
|
? [`到达${arrived}/${total}吨`]
|
||||||
: [`到达 ${arrived}/${total}吨`, `已调度 ${dispatched}/到达${arrived}/${total}吨`],
|
: [`到达 ${arrived}/${total}吨`, `已调度 ${dispatched}/到达${arrived}/${total}吨`],
|
||||||
@@ -494,31 +580,43 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.master-search {
|
.master-order-page {
|
||||||
margin-bottom: 12px;
|
&__search {
|
||||||
padding: 12px 12px 4px;
|
padding: 12px 12px 4px;
|
||||||
|
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 {
|
|
||||||
display: flex;
|
:deep(.el-input),
|
||||||
justify-content: flex-end;
|
:deep(.el-select),
|
||||||
align-items: center;
|
:deep(.el-date-editor.el-input),
|
||||||
gap: 12px;
|
:deep(.el-date-editor.el-input__wrapper),
|
||||||
min-height: 40px;
|
:deep(.el-date-editor--datetimerange) {
|
||||||
.el-icon {
|
width: 100%;
|
||||||
margin-right: 4px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.master-list-panel {
|
.master-list-panel {
|
||||||
@@ -612,10 +710,16 @@ export default {
|
|||||||
line-height: 1.8;
|
line-height: 1.8;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
strong {
|
strong {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 150px;
|
||||||
|
overflow: hidden;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
max-width: 180px;
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: bottom;
|
||||||
|
cursor: default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.route-connector {
|
.route-connector {
|
||||||
|
|||||||
@@ -1,61 +1,98 @@
|
|||||||
<template>
|
<template>
|
||||||
<basic-container class="transport-plan-dispatch-page">
|
<basic-container class="transport-plan-dispatch-page">
|
||||||
<div v-loading="loading" class="transport-plan-dispatch-page__shell">
|
<div v-loading="loading" class="transport-plan-dispatch-page__shell">
|
||||||
<!-- 顶部信息区 -->
|
<!-- 顶部信息区:对齐运单详情汇总样式 -->
|
||||||
<div class="transport-plan-dispatch-page__top">
|
<section-card class="transport-plan-dispatch-page__summary">
|
||||||
<div class="transport-plan-dispatch-page__heading">
|
<div class="transport-plan-dispatch-page__heading">
|
||||||
<div class="transport-plan-dispatch-page__heading-title">
|
|
||||||
<el-button icon="el-icon-arrow-left" text @click="handleBack">返回</el-button>
|
<el-button icon="el-icon-arrow-left" text @click="handleBack">返回</el-button>
|
||||||
<span class="transport-plan-dispatch-page__heading-name">计划调度</span>
|
<strong>计划调度</strong>
|
||||||
<span class="transport-plan-dispatch-page__heading-no">
|
<span>{{ planData.planNo || planData.loadingNo || '-' }}</span>
|
||||||
{{ planData.planNo || planData.loadingNo || '-' }}
|
<span class="detail-status-text" :class="statusTextClass">
|
||||||
</span>
|
|
||||||
<el-tag :type="getStatusTagType(planData.businessStatus)" effect="light" class="status-text">
|
|
||||||
{{ planData.businessStatusName || '-' }}
|
{{ planData.businessStatusName || '-' }}
|
||||||
</el-tag>
|
</span>
|
||||||
<el-tag type="primary" effect="light">
|
<span class="detail-status-text detail-transport-type">
|
||||||
{{ planData.transportTypeName || '公路整车' }}
|
{{ planData.transportTypeName || '公路整车' }}
|
||||||
</el-tag>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="transport-plan-dispatch-page__summary">
|
|
||||||
<section-card title="基本信息" class="transport-plan-dispatch-page__summary-card">
|
|
||||||
<div class="transport-plan-dispatch-page__summary-grid">
|
<div class="transport-plan-dispatch-page__summary-grid">
|
||||||
<div class="transport-plan-dispatch-page__summary-item">
|
<div class="transport-plan-dispatch-page__summary-item">
|
||||||
<div class="transport-plan-dispatch-page__summary-label">客户</div>
|
<span class="transport-plan-dispatch-page__summary-label">客户</span>
|
||||||
<div class="transport-plan-dispatch-page__summary-value">
|
<span class="transport-plan-dispatch-page__summary-value">
|
||||||
{{ planData.customerName || '-' }}
|
{{ planData.customerName || '-' }}
|
||||||
</div>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="transport-plan-dispatch-page__summary-item">
|
<div class="transport-plan-dispatch-page__summary-item">
|
||||||
<div class="transport-plan-dispatch-page__summary-label">项目</div>
|
<span class="transport-plan-dispatch-page__summary-label">合同编号</span>
|
||||||
<div class="transport-plan-dispatch-page__summary-value">
|
<span class="transport-plan-dispatch-page__summary-value is-link">
|
||||||
{{ planData.projectName || '-' }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="transport-plan-dispatch-page__summary-item">
|
|
||||||
<div class="transport-plan-dispatch-page__summary-label">合同编号</div>
|
|
||||||
<div class="transport-plan-dispatch-page__summary-value">
|
|
||||||
{{ planData.contractNo || '-' }}
|
{{ planData.contractNo || '-' }}
|
||||||
</div>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="transport-plan-dispatch-page__summary-item">
|
<div class="transport-plan-dispatch-page__summary-item">
|
||||||
<div class="transport-plan-dispatch-page__summary-label">计划执行时间</div>
|
<span class="transport-plan-dispatch-page__summary-label">项目</span>
|
||||||
<div class="transport-plan-dispatch-page__summary-value">
|
<span class="transport-plan-dispatch-page__summary-value">
|
||||||
|
{{ planData.projectName || '-' }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="transport-plan-dispatch-page__summary-item">
|
||||||
|
<span class="transport-plan-dispatch-page__summary-label">计划执行时间</span>
|
||||||
|
<span class="transport-plan-dispatch-page__summary-value">
|
||||||
{{ formatDateRange(planData.planStartDate, planData.planEndDate) }}
|
{{ formatDateRange(planData.planStartDate, planData.planEndDate) }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="transport-plan-dispatch-page__summary-item is-goods">
|
||||||
<div class="transport-plan-dispatch-page__summary-item is-wide">
|
<span class="transport-plan-dispatch-page__summary-label">货物信息</span>
|
||||||
<div class="transport-plan-dispatch-page__summary-label">货物信息</div>
|
<span class="transport-plan-dispatch-page__summary-value is-wrap">
|
||||||
<div class="transport-plan-dispatch-page__summary-value">
|
|
||||||
{{ planData.goodsInfo || formatGoodsInfo(planData) }}
|
{{ planData.goodsInfo || formatGoodsInfo(planData) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="transport-plan-dispatch-page__route">
|
||||||
|
<div class="transport-plan-dispatch-page__route-item is-start">
|
||||||
|
<div class="transport-plan-dispatch-page__route-marker">起</div>
|
||||||
|
<div class="transport-plan-dispatch-page__route-detail">
|
||||||
|
<strong class="transport-plan-dispatch-page__route-name">
|
||||||
|
{{
|
||||||
|
formatRouteCityDistrict(planData.departureAddress || planData.departureName)
|
||||||
|
}}
|
||||||
|
</strong>
|
||||||
|
<el-tooltip
|
||||||
|
:content="planData.departureAddress || planData.departureName || '-'"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<span class="transport-plan-dispatch-page__route-addr">
|
||||||
|
{{ planData.departureAddress || planData.departureName || '-' }}
|
||||||
|
</span>
|
||||||
|
</el-tooltip>
|
||||||
|
<div class="transport-plan-dispatch-page__route-contact">
|
||||||
|
<span>联系人:{{ planData.departureContact || '-' }}</span>
|
||||||
|
<span>联系方式:{{ planData.departurePhone || '-' }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="transport-plan-dispatch-page__summary-item">
|
</div>
|
||||||
<div class="transport-plan-dispatch-page__summary-label">附件</div>
|
<span class="transport-plan-dispatch-page__route-line" aria-hidden="true" />
|
||||||
<div class="transport-plan-dispatch-page__summary-value">
|
<div class="transport-plan-dispatch-page__route-item is-end">
|
||||||
<template v-if="attachmentList.length">
|
<div class="transport-plan-dispatch-page__route-marker">终</div>
|
||||||
|
<div class="transport-plan-dispatch-page__route-detail">
|
||||||
|
<strong class="transport-plan-dispatch-page__route-name">
|
||||||
|
{{ formatRouteCityDistrict(planData.arrivalAddress || planData.arrivalName) }}
|
||||||
|
</strong>
|
||||||
|
<el-tooltip
|
||||||
|
:content="planData.arrivalAddress || planData.arrivalName || '-'"
|
||||||
|
placement="top"
|
||||||
|
>
|
||||||
|
<span class="transport-plan-dispatch-page__route-addr">
|
||||||
|
{{ planData.arrivalAddress || planData.arrivalName || '-' }}
|
||||||
|
</span>
|
||||||
|
</el-tooltip>
|
||||||
|
<div class="transport-plan-dispatch-page__route-contact">
|
||||||
|
<span>联系人:{{ planData.arrivalContact || '-' }}</span>
|
||||||
|
<span>联系方式:{{ planData.arrivalPhone || '-' }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="transport-plan-dispatch-page__attachments">
|
||||||
|
<span class="transport-plan-dispatch-page__summary-label">附件</span>
|
||||||
|
<div>
|
||||||
<el-link
|
<el-link
|
||||||
v-for="(item, index) in attachmentList"
|
v-for="(item, index) in attachmentList"
|
||||||
:key="index"
|
:key="index"
|
||||||
@@ -63,55 +100,15 @@
|
|||||||
:href="item.url"
|
:href="item.url"
|
||||||
:underline="false"
|
:underline="false"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="transport-plan-dispatch-page__attachment-link"
|
|
||||||
>
|
>
|
||||||
{{ item.name || item.originalName || '附件' }}
|
{{ item.name || item.originalName || '附件' }}
|
||||||
</el-link>
|
</el-link>
|
||||||
</template>
|
<span v-if="!attachmentList.length">-</span>
|
||||||
<span v-else>-</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section-card>
|
</section-card>
|
||||||
|
|
||||||
<section-card title="收发货路线" class="transport-plan-dispatch-page__route-card">
|
|
||||||
<div class="transport-plan-dispatch-page__route">
|
|
||||||
<div class="transport-plan-dispatch-page__route-item">
|
|
||||||
<span class="transport-plan-dispatch-page__route-badge is-start">起</span>
|
|
||||||
<div class="transport-plan-dispatch-page__route-body">
|
|
||||||
<div class="transport-plan-dispatch-page__route-title">
|
|
||||||
{{ planData.departureName || '-' }}
|
|
||||||
</div>
|
|
||||||
<div class="transport-plan-dispatch-page__route-address">
|
|
||||||
{{ formatAddress(planData.departureAddress) }}
|
|
||||||
</div>
|
|
||||||
<div class="transport-plan-dispatch-page__route-contact">
|
|
||||||
{{ formatContact(planData.departureContact, planData.departurePhone) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="transport-plan-dispatch-page__route-vehicle">
|
|
||||||
<el-icon><Van /></el-icon>
|
|
||||||
</div>
|
|
||||||
<div class="transport-plan-dispatch-page__route-item">
|
|
||||||
<span class="transport-plan-dispatch-page__route-badge is-end">终</span>
|
|
||||||
<div class="transport-plan-dispatch-page__route-body">
|
|
||||||
<div class="transport-plan-dispatch-page__route-title">
|
|
||||||
{{ planData.arrivalName || '-' }}
|
|
||||||
</div>
|
|
||||||
<div class="transport-plan-dispatch-page__route-address">
|
|
||||||
{{ formatAddress(planData.arrivalAddress) }}
|
|
||||||
</div>
|
|
||||||
<div class="transport-plan-dispatch-page__route-contact">
|
|
||||||
{{ formatContact(planData.arrivalContact, planData.arrivalPhone) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section-card>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 调度列表 -->
|
<!-- 调度列表 -->
|
||||||
<section-card class="transport-plan-dispatch-page__list-card">
|
<section-card class="transport-plan-dispatch-page__list-card">
|
||||||
<template #title>
|
<template #title>
|
||||||
@@ -204,7 +201,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Van } from '@element-plus/icons-vue';
|
|
||||||
import { getDetail, dispatch } from '@/api/business/transport-plan';
|
import { getDetail, dispatch } from '@/api/business/transport-plan';
|
||||||
import SectionCard from '@/components/section-card/main.vue';
|
import SectionCard from '@/components/section-card/main.vue';
|
||||||
import TransportPlanPage from './components/transport-plan-page.vue';
|
import TransportPlanPage from './components/transport-plan-page.vue';
|
||||||
@@ -216,7 +212,6 @@ const TRANSPORT_PLAN_QUANTITY_UNIT = '吨';
|
|||||||
export default {
|
export default {
|
||||||
name: 'TransportPlanDispatch',
|
name: 'TransportPlanDispatch',
|
||||||
components: {
|
components: {
|
||||||
Van,
|
|
||||||
SectionCard,
|
SectionCard,
|
||||||
TransportPlanPage,
|
TransportPlanPage,
|
||||||
},
|
},
|
||||||
@@ -237,11 +232,21 @@ export default {
|
|||||||
planId() {
|
planId() {
|
||||||
return this.$route.query.planId;
|
return this.$route.query.planId;
|
||||||
},
|
},
|
||||||
|
statusTextClass() {
|
||||||
|
const status = this.planData.businessStatus;
|
||||||
|
if (status === 2 || status === '2') return 'status-text-success';
|
||||||
|
if (status === 1 || status === '1') return 'is-dispatching';
|
||||||
|
if (status === 3 || status === '3') return 'is-danger';
|
||||||
|
return 'is-info';
|
||||||
|
},
|
||||||
summaryText() {
|
summaryText() {
|
||||||
const goodsList = this.parseGoodsList(this.planData.goodsJson);
|
const goodsList = this.parseGoodsList(this.planData.goodsJson);
|
||||||
if (!goodsList.length) {
|
if (!goodsList.length) {
|
||||||
const total = Number(this.planData.totalQuantity || 0);
|
const total = Number(this.planData.totalQuantity || 0);
|
||||||
const dispatched = this.calculateDispatchedQuantity();
|
const dispatched = this.calculateDispatchedQuantity();
|
||||||
|
if (total <= 0) {
|
||||||
|
return `已调度 ${dispatched.toFixed(2)}吨`;
|
||||||
|
}
|
||||||
const remaining = Math.max(total - dispatched, 0);
|
const remaining = Math.max(total - dispatched, 0);
|
||||||
return `共${total}吨 | 已调度 ${dispatched.toFixed(2)}吨,剩余${remaining.toFixed(2)}吨`;
|
return `共${total}吨 | 已调度 ${dispatched.toFixed(2)}吨,剩余${remaining.toFixed(2)}吨`;
|
||||||
}
|
}
|
||||||
@@ -264,6 +269,9 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const parts = Object.entries(summary).map(([unit, data]) => {
|
const parts = Object.entries(summary).map(([unit, data]) => {
|
||||||
|
if (data.total <= 0) {
|
||||||
|
return `已调度 ${data.dispatched.toFixed(2)}${unit}`;
|
||||||
|
}
|
||||||
const remaining = Math.max(data.total - data.dispatched, 0);
|
const remaining = Math.max(data.total - data.dispatched, 0);
|
||||||
return `${data.total}${unit} | 已调度 ${data.dispatched.toFixed(2)}${unit},剩余${remaining.toFixed(
|
return `${data.total}${unit} | 已调度 ${data.dispatched.toFixed(2)}${unit},剩余${remaining.toFixed(
|
||||||
2
|
2
|
||||||
@@ -276,13 +284,20 @@ export default {
|
|||||||
const goodsList = this.parseGoodsList(this.planData.goodsJson);
|
const goodsList = this.parseGoodsList(this.planData.goodsJson);
|
||||||
if (!goodsList.length) {
|
if (!goodsList.length) {
|
||||||
const total = Number(this.planData.totalQuantity || 0);
|
const total = Number(this.planData.totalQuantity || 0);
|
||||||
|
if (total <= 0) return true;
|
||||||
const dispatched = this.calculateDispatchedQuantity();
|
const dispatched = this.calculateDispatchedQuantity();
|
||||||
return dispatched < total;
|
return dispatched < total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hasPositiveTotal = goodsList.some(
|
||||||
|
goods => Number(goods.quantity || 0) > 0
|
||||||
|
);
|
||||||
|
if (!hasPositiveTotal) return true;
|
||||||
|
|
||||||
return goodsList.some(goods => {
|
return goodsList.some(goods => {
|
||||||
const unit = goods.quantityUnit || TRANSPORT_PLAN_QUANTITY_UNIT;
|
const unit = goods.quantityUnit || TRANSPORT_PLAN_QUANTITY_UNIT;
|
||||||
const totalQty = Number(goods.quantity || 0);
|
const totalQty = Number(goods.quantity || 0);
|
||||||
|
if (totalQty <= 0) return true;
|
||||||
const dispatchedQty = this.dispatchList
|
const dispatchedQty = this.dispatchList
|
||||||
.filter(item => item.quantityUnit === unit)
|
.filter(item => item.quantityUnit === unit)
|
||||||
.reduce((sum, item) => sum + Number(item.quantity || 0), 0);
|
.reduce((sum, item) => sum + Number(item.quantity || 0), 0);
|
||||||
@@ -364,15 +379,6 @@ export default {
|
|||||||
calculateDispatchedQuantity() {
|
calculateDispatchedQuantity() {
|
||||||
return this.dispatchList.reduce((sum, item) => sum + Number(item.quantity || 0), 0);
|
return this.dispatchList.reduce((sum, item) => sum + Number(item.quantity || 0), 0);
|
||||||
},
|
},
|
||||||
getStatusTagType(status) {
|
|
||||||
const statusMap = {
|
|
||||||
0: 'info',
|
|
||||||
1: 'warning',
|
|
||||||
2: 'success',
|
|
||||||
3: 'danger',
|
|
||||||
};
|
|
||||||
return statusMap[status] || 'info';
|
|
||||||
},
|
|
||||||
formatDateRange(startDate, endDate) {
|
formatDateRange(startDate, endDate) {
|
||||||
const dates = [startDate, endDate].filter(Boolean);
|
const dates = [startDate, endDate].filter(Boolean);
|
||||||
return dates.length ? dates.join(' ~ ') : '-';
|
return dates.length ? dates.join(' ~ ') : '-';
|
||||||
@@ -382,9 +388,30 @@ export default {
|
|||||||
const match = address.match(/^(.*?省)?(.*?市)?(.*?区|.*?县)?/);
|
const match = address.match(/^(.*?省)?(.*?市)?(.*?区|.*?县)?/);
|
||||||
return match ? match[0] || address : address;
|
return match ? match[0] || address : address;
|
||||||
},
|
},
|
||||||
formatContact(contact, phone) {
|
formatProvinceCityDistrict(value) {
|
||||||
const parts = [contact, phone].filter(Boolean);
|
const text = String(value || '').trim();
|
||||||
return parts.length ? parts.join(' / ') : '-';
|
if (!text) return '-';
|
||||||
|
const districtMatch = text.match(/(?:自治县|自治旗|林区|矿区|新区|开发区|区|县|旗)/);
|
||||||
|
if (districtMatch) {
|
||||||
|
return text.slice(0, districtMatch.index + districtMatch[0].length);
|
||||||
|
}
|
||||||
|
const cityMatch = text.match(/市/);
|
||||||
|
return cityMatch ? text.slice(0, cityMatch.index + 1) : text;
|
||||||
|
},
|
||||||
|
formatRouteCityDistrict(value) {
|
||||||
|
const text = String(value || '').trim();
|
||||||
|
if (!text) return '-';
|
||||||
|
const provinceMatch = text.match(/^.+?(?:省|自治区|特别行政区)/);
|
||||||
|
const cityRegion = provinceMatch ? text.slice(provinceMatch[0].length) : text;
|
||||||
|
const cityMatch = cityRegion.match(/^(.+?市)/);
|
||||||
|
if (!cityMatch) return this.formatProvinceCityDistrict(text);
|
||||||
|
const city = cityMatch[1];
|
||||||
|
const remainder = cityRegion.slice(city.length);
|
||||||
|
const districtMatch = remainder.match(
|
||||||
|
/^(.+?(?:自治县|自治旗|林区|矿区|新区|开发区|区|县|旗){1,2})/
|
||||||
|
);
|
||||||
|
const district = districtMatch ? districtMatch[1] : '';
|
||||||
|
return [city, district].filter(Boolean).join(' ');
|
||||||
},
|
},
|
||||||
formatDriver(row) {
|
formatDriver(row) {
|
||||||
const parts = [row.driverName, row.driverPhone].filter(Boolean);
|
const parts = [row.driverName, row.driverPhone].filter(Boolean);
|
||||||
@@ -419,32 +446,33 @@ export default {
|
|||||||
this.$message.warning('待调度列表货物总量已达到计划总量,不能新增调度明细');
|
this.$message.warning('待调度列表货物总量已达到计划总量,不能新增调度明细');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.openPageDispatchItemDialog(-1);
|
||||||
// 调用 transport-plan-page 组件的方法打开弹窗
|
|
||||||
this.$nextTick(() => {
|
|
||||||
const component = this.$refs.transportPlanPageRef;
|
|
||||||
if (component) {
|
|
||||||
// 设置调度数据
|
|
||||||
component.dispatchRow = this.planData;
|
|
||||||
component.dispatchRows = [...this.dispatchList];
|
|
||||||
// 打开新增弹窗
|
|
||||||
component.openDispatchItemDialog(-1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
handleEdit(row, index) {
|
handleEdit(row, index) {
|
||||||
// 调用 transport-plan-page 组件的方法打开弹窗
|
this.openPageDispatchItemDialog(index, row);
|
||||||
|
},
|
||||||
|
openPageDispatchItemDialog(index = -1, row) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const component = this.$refs.transportPlanPageRef;
|
const component = this.$refs.transportPlanPageRef;
|
||||||
if (component) {
|
if (!component) return;
|
||||||
// 设置调度数据
|
|
||||||
component.dispatchRow = this.planData;
|
component.dispatchRow = this.planData;
|
||||||
component.dispatchRows = [...this.dispatchList];
|
component.dispatchRows = [...this.dispatchList];
|
||||||
// 打开编辑弹窗
|
this.bindDispatchItemSaveSync(component);
|
||||||
component.openDispatchItemDialog(index, row);
|
if (index >= 0) component.openDispatchItemDialog(index, row);
|
||||||
}
|
else component.openDispatchItemDialog(-1);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
bindDispatchItemSaveSync(component) {
|
||||||
|
if (component.__dispatchListSaveSynced) return;
|
||||||
|
const originalSave = component.saveDispatchItem;
|
||||||
|
component.saveDispatchItem = (...args) => {
|
||||||
|
originalSave.apply(component, args);
|
||||||
|
if (!component.dispatchItemBox) {
|
||||||
|
this.dispatchList = [...(component.dispatchRows || [])];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
component.__dispatchListSaveSynced = true;
|
||||||
|
},
|
||||||
handleDelete(index) {
|
handleDelete(index) {
|
||||||
this.$confirm('确定删除该调度明细?', '提示', {
|
this.$confirm('确定删除该调度明细?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@@ -551,126 +579,189 @@ export default {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__top {
|
&__summary {
|
||||||
display: flex;
|
:deep(.el-card__body) {
|
||||||
flex-direction: column;
|
padding: 18px 22px;
|
||||||
gap: 16px;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__heading {
|
&__heading {
|
||||||
padding: 16px;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 4px;
|
|
||||||
|
|
||||||
&-title {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
margin-bottom: 18px;
|
||||||
|
|
||||||
|
strong {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-status-text {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 28px;
|
||||||
|
padding: 0 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-text-success,
|
||||||
|
.is-dispatching {
|
||||||
|
color: #67c23a;
|
||||||
|
background: #e1f3d8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-transport-type {
|
||||||
|
color: #409eff;
|
||||||
|
background: #ecf5ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-danger {
|
||||||
|
color: #f56c6c;
|
||||||
|
background: #fef0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-info {
|
||||||
|
color: #909399;
|
||||||
|
background: #f4f4f5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__summary-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, minmax(120px, 1fr)) minmax(360px, 1.5fr);
|
||||||
|
gap: 16px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__summary-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
&.is-goods {
|
||||||
|
grid-column: 1 / 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__summary-label {
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__summary-value {
|
||||||
|
overflow: hidden;
|
||||||
|
color: #303133;
|
||||||
|
font-weight: 500;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
&.is-link {
|
||||||
|
color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.is-wrap {
|
||||||
|
white-space: normal;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__route {
|
||||||
|
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;
|
||||||
|
min-width: 0;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__route-marker {
|
||||||
|
display: inline-flex;
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #409eff;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
|
||||||
|
|
||||||
&-name {
|
.is-end & {
|
||||||
font-size: 18px;
|
background: #67c23a;
|
||||||
}
|
|
||||||
|
|
||||||
&-no {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #606266;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__summary {
|
&__route-line {
|
||||||
|
width: 100%;
|
||||||
|
height: 6px;
|
||||||
|
margin-top: 15px;
|
||||||
|
border-radius: 1px;
|
||||||
|
background: #e4e7ed;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__route-detail {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 16px;
|
min-width: 0;
|
||||||
|
flex-direction: column;
|
||||||
&-card {
|
align-items: center;
|
||||||
flex: 1;
|
gap: 5px;
|
||||||
|
margin-top: 8px;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-grid {
|
&__route-name {
|
||||||
display: grid;
|
max-width: 100%;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
overflow: hidden;
|
||||||
gap: 16px;
|
color: #303133;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.35;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-item {
|
&__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;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
|
||||||
&.is-wide {
|
div {
|
||||||
grid-column: 1 / -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-label {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #909399;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-value {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #303133;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__route-card {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__route {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
flex-wrap: wrap;
|
||||||
gap: 24px;
|
gap: 16px;
|
||||||
|
|
||||||
&-item {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-badge {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
border-radius: 50%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 14px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
|
|
||||||
&.is-start {
|
|
||||||
background: #67c23a;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.is-end {
|
|
||||||
background: #409eff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&-body {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-title {
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-address,
|
|
||||||
&-contact {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #606266;
|
|
||||||
}
|
|
||||||
|
|
||||||
&-vehicle {
|
|
||||||
font-size: 24px;
|
|
||||||
color: #909399;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,12 +797,42 @@ export default {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__attachment-link {
|
@media (max-width: 1200px) {
|
||||||
margin-right: 12px;
|
&__summary-grid {
|
||||||
|
grid-template-columns: repeat(4, minmax(130px, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
&__summary-item.is-goods,
|
||||||
|
&__attachments {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__route {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
grid-row: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-text {
|
@media (max-width: 800px) {
|
||||||
font-size: 12px;
|
&__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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
><el-select v-model="query.processStatus" clearable placeholder="全部"
|
><el-select v-model="query.processStatus" clearable placeholder="全部"
|
||||||
><el-option label="上传中" value="上传中" /><el-option
|
><el-option label="上传中" value="上传中" /><el-option
|
||||||
label="处理中"
|
label="处理中"
|
||||||
value="处理中" /><el-option label="处理完成" value="处理完成" /></el-select
|
value="处理中" /><el-option label="处理完成" value="处理完成" /><el-option
|
||||||
|
label="处理失败"
|
||||||
|
value="处理失败" /></el-select
|
||||||
></el-form-item>
|
></el-form-item>
|
||||||
<el-form-item label="运单批次号"
|
<el-form-item label="运单批次号"
|
||||||
><el-input v-model="query.waybillBatchNo" clearable placeholder="请输入"
|
><el-input v-model="query.waybillBatchNo" clearable placeholder="请输入"
|
||||||
@@ -84,7 +86,14 @@
|
|||||||
min-width="160"
|
min-width="160"
|
||||||
><template #default="{ row }">{{ row.carrierName || '-' }}</template></el-table-column
|
><template #default="{ row }">{{ row.carrierName || '-' }}</template></el-table-column
|
||||||
>
|
>
|
||||||
<el-table-column prop="processStatus" label="处理状态" width="120" /><el-table-column
|
<el-table-column prop="processStatus" label="处理状态" width="120"
|
||||||
|
><template #default="{ row }"
|
||||||
|
><span
|
||||||
|
:class="{ 'voucher-manage-page__process-failed': row.processStatus === '处理失败' }"
|
||||||
|
>{{ row.processStatus }}</span
|
||||||
|
></template
|
||||||
|
></el-table-column
|
||||||
|
><el-table-column
|
||||||
prop="voucherCount"
|
prop="voucherCount"
|
||||||
label="凭证数量"
|
label="凭证数量"
|
||||||
width="100"
|
width="100"
|
||||||
@@ -109,7 +118,7 @@
|
|||||||
placement="top"
|
placement="top"
|
||||||
><el-icon class="voucher-manage-page__audit-reject-icon"><WarnTriangleFilled /></el-icon
|
><el-icon class="voucher-manage-page__audit-reject-icon"><WarnTriangleFilled /></el-icon
|
||||||
></el-tooltip></span></template
|
></el-tooltip></span></template
|
||||||
></el-table-column><el-table-column label="操作" width="320" fixed="right" align="center"
|
></el-table-column><el-table-column label="操作" width="220" fixed="right" align="center"
|
||||||
><template #default="{ row }"
|
><template #default="{ row }"
|
||||||
><div class="voucher-manage-page__actions">
|
><div class="voucher-manage-page__actions">
|
||||||
<el-link
|
<el-link
|
||||||
@@ -130,7 +139,7 @@
|
|||||||
@click="download(row)"
|
@click="download(row)"
|
||||||
>下载</el-link
|
>下载</el-link
|
||||||
><el-link
|
><el-link
|
||||||
v-if="row.auditStatus === '审核驳回'"
|
v-if="row.auditStatus === '审核驳回' || row.processStatus === '处理失败'"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="openUpload(row, 'reupload')"
|
@click="openUpload(row, 'reupload')"
|
||||||
>重新上传</el-link
|
>重新上传</el-link
|
||||||
@@ -145,7 +154,7 @@
|
|||||||
@click="openBatchDialog(row)"
|
@click="openBatchDialog(row)"
|
||||||
>更换运单批次</el-link
|
>更换运单批次</el-link
|
||||||
><el-link
|
><el-link
|
||||||
v-if="row.processStatus === '上传中' || row.auditStatus === '审核驳回'"
|
v-if="row.processStatus === '上传中' || row.processStatus === '处理失败' || row.auditStatus === '审核驳回'"
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="removeRow(row)"
|
@click="removeRow(row)"
|
||||||
>删除</el-link
|
>删除</el-link
|
||||||
@@ -1238,7 +1247,15 @@ const view = async row => {
|
|||||||
query: { id: row.id, batchNo: row.voucherBatchNo },
|
query: { id: row.id, batchNo: row.voucherBatchNo },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const download = row => window.open(row.fileUrl, '_blank');
|
const download = row => {
|
||||||
|
const url = row?.fileUrl;
|
||||||
|
if (!url) {
|
||||||
|
ElMessage.warning('附件地址为空,无法下载');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 去掉 URL 中 ? 后的临时鉴权参数,避免签名过期导致无法下载
|
||||||
|
window.open(String(url).split('?')[0], '_blank');
|
||||||
|
};
|
||||||
const handleAuditPass = row =>
|
const handleAuditPass = row =>
|
||||||
ElMessageBox.confirm(`确认审核通过凭证批次"${row.voucherBatchNo}"吗?`, '提示', {
|
ElMessageBox.confirm(`确认审核通过凭证批次"${row.voucherBatchNo}"吗?`, '提示', {
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
@@ -1329,6 +1346,9 @@ load();
|
|||||||
color: #f56c6c;
|
color: #f56c6c;
|
||||||
cursor: help;
|
cursor: help;
|
||||||
}
|
}
|
||||||
|
&__process-failed {
|
||||||
|
color: #f56c6c;
|
||||||
|
}
|
||||||
&__actions {
|
&__actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|||||||
@@ -169,12 +169,6 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<div
|
|
||||||
v-if="!latestChangeLoading && !latestChangeRows.length"
|
|
||||||
class="settlement-detail-page__empty"
|
|
||||||
>
|
|
||||||
暂无变更记录
|
|
||||||
</div>
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
@@ -2734,12 +2728,6 @@ export default {
|
|||||||
padding: 16px 0;
|
padding: 16px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settlement-detail-page__empty {
|
|
||||||
padding: 24px 0;
|
|
||||||
color: #909399;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.settlement-detail-page__dialog-form {
|
.settlement-detail-page__dialog-form {
|
||||||
padding: 16px 20px;
|
padding: 16px 20px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
|||||||
@@ -56,6 +56,14 @@
|
|||||||
@click="handleAudit"
|
@click="handleAudit"
|
||||||
>审 核
|
>审 核
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
:loading="iamSyncLoading"
|
||||||
|
v-if="userInfo.authority.includes('admin') && !auditMode"
|
||||||
|
@click="handleIamSync"
|
||||||
|
>同步人员
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
plain
|
plain
|
||||||
@@ -348,6 +356,7 @@ import {
|
|||||||
remove,
|
remove,
|
||||||
update,
|
update,
|
||||||
add,
|
add,
|
||||||
|
syncIamAccounts,
|
||||||
grant,
|
grant,
|
||||||
resetPassword,
|
resetPassword,
|
||||||
setPassword,
|
setPassword,
|
||||||
@@ -393,6 +402,7 @@ export default {
|
|||||||
selectionList: [],
|
selectionList: [],
|
||||||
query: {},
|
query: {},
|
||||||
loading: true,
|
loading: true,
|
||||||
|
iamSyncLoading: false,
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
@@ -553,6 +563,25 @@ 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 ? '取消主管成功!' : '设置主管成功!';
|
||||||
|
|||||||
@@ -4758,7 +4758,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;
|
||||||
|
|||||||
Reference in New Issue
Block a user