Merge remote-tracking branch 'origin/master' into feature/bfi-api-rate

# Conflicts:
#	src/views/vehicle/customer-archive.vue
This commit is contained in:
刘泉佳
2026-09-24 03:15:23 +08:00
114 changed files with 10215 additions and 2861 deletions
+9
View File
@@ -79,6 +79,15 @@ export const cancel = id =>
},
});
export const start = id =>
request({
url: `${baseUrl}/start`,
method: 'post',
params: {
id,
},
});
export const complete = id =>
request({
url: `${baseUrl}/complete`,
+1
View File
@@ -16,6 +16,7 @@ export const submit = api.submit;
export const remove = api.remove;
// 项目资金使用风险统计(高风险 / 中风险数量),供列表头部快速筛选标签使用
// 暂未启用:后端 /fund-risk-stats 端点尚未实现,列表页已移除调用,等后端就绪后恢复
export const getFundRiskStats = params =>
request({
url: `${baseUrl}/fund-risk-stats`,
+19
View File
@@ -33,6 +33,25 @@ export const getPunchRecords = waybillId =>
method: 'get',
params: { waybillId },
});
/** 运单车辆实时定位 */
export const locateVehicle = id =>
request({
url: `${baseUrl}/locate`,
method: 'post',
params: { id },
timeout: 60000,
});
/** 运单车辆历史轨迹 */
export const trackVehicle = (id, startDate, endDate) =>
request({
url: `${baseUrl}/track`,
method: 'post',
params: { id, startDate, endDate },
timeout: 60000,
});
export const roadLoading = ids =>
request({
url: `${baseUrl}/road-loading`,
+23
View File
@@ -0,0 +1,23 @@
import request from '@/axios';
export const getMkPublicDetail = (bizType, id) => {
return request({
url: `/blade-transport/mk-process/public/${bizType}/detail`,
method: 'get',
meta: {
isToken: false,
},
params: { id },
});
};
export const postMkPublicProcessMessage = (bizType, data) => {
return request({
url: `/blade-transport/mk-process/public/${bizType}/process-message`,
method: 'post',
meta: {
isToken: false,
},
data,
});
};
+1 -1
View File
@@ -26,7 +26,7 @@ export const syncKingdeeResult = () =>
export const paymentTypeOptions = [
{ label: '项目预付', value: 'project_advance' },
{ label: '进度预付', value: 'progress_advance' },
{ label: '结算付款', value: 'settlement_payment' },
{ label: '尾款付款', value: 'settlement_payment' },
];
export const approvalStatusOptions = [
{ label: '草稿', value: 'draft' },
+31
View File
@@ -0,0 +1,31 @@
import request from '@/axios';
/**
* 调用 MK processSubmit 提交审核流
* @param {Object} data
* @param {string} data.templateCode 模板编码
* @param {string} data.submitIdentity 提交人(手机号)
* @param {string} data.loginName 登录账号(手机号)
* @param {string} data.formInstanceId 业务表单实例 id
* @param {string} [data.subject] 流程标题
*/
export const processSubmit = data => {
return request({
url: '/blade-system/businessProcess/processSubmit',
method: 'post',
data,
});
};
/**
* 调用 MK processDelete 删除审核流(驳回后重新提交前使用)
* @param {Object} data
* @param {string} data.formInstanceId 业务表单实例 id
*/
export const processDelete = data => {
return request({
url: '/blade-system/businessProcess/processDelete',
method: 'post',
data,
});
};
+42
View File
@@ -41,6 +41,48 @@ export const add = row => {
});
};
export const syncIamOrganizations = () => {
return request({
url: '/blade-system/dept/sync-iam-organizations',
method: 'post',
});
};
export const clearNonTopDept = signal => {
return request({
url: '/blade-system/dept/clear-non-top',
method: 'post',
timeout: 60000,
signal,
});
};
export const syncOaCompany = (current = 1, size = 20, signal) => {
return request({
url: '/blade-system/dept/sync-oa-company',
method: 'post',
params: {
current,
size,
},
timeout: 60000,
signal,
});
};
export const syncOaDepartment = (current = 1, size = 20, signal) => {
return request({
url: '/blade-system/dept/sync-oa-department',
method: 'post',
params: {
current,
size,
},
timeout: 60000,
signal,
});
};
export const update = row => {
return request({
url: '/blade-system/dept/submit',
+13
View File
@@ -31,6 +31,19 @@ export const add = row => {
});
};
export const syncIamAccounts = (current = 1, size = 50, signal) => {
return request({
url: '/blade-system/user/sync-iam-accounts',
method: 'post',
params: {
current,
size,
},
timeout: 60000,
signal,
});
};
export const update = row => {
return request({
url: '/blade-system/user/update',
+39
View File
@@ -22,6 +22,19 @@ export const getDetail = id => {
});
};
export const getPublicDetail = id => {
return request({
url: '/blade-transport/customer-archive/public/detail',
method: 'get',
meta: {
isToken: false,
},
params: {
id,
},
});
};
export const getChangeRecordList = (customerId, current, size) => {
return request({
url: '/blade-transport/customer-archive/change-record/list',
@@ -34,6 +47,32 @@ export const getChangeRecordList = (customerId, current, size) => {
});
};
export const getPublicChangeRecordList = (customerId, current, size) => {
return request({
url: '/blade-transport/customer-archive/public/change-record/list',
method: 'get',
meta: {
isToken: false,
},
params: {
customerId,
current,
size,
},
});
};
export const postPublicProcessMessage = data => {
return request({
url: '/blade-transport/customer-archive/public/process-message',
method: 'post',
meta: {
isToken: false,
},
data,
});
};
export const submit = row => {
return request({
url: '/blade-transport/customer-archive/submit',
+65 -21
View File
@@ -10,12 +10,8 @@
<el-button type="primary" :loading="searching" @click="searchKeyword">搜索</el-button>
</div>
<div class="address-map-picker__content">
<map-search-results
v-if="searchResults.length"
:results="searchResults"
@select="selectSearchResult"
/>
<div ref="map" class="address-map-picker__map"></div>
<map-search-results :results="searchResults" @select="selectSearchResult" />
</div>
<div class="address-map-picker__info">{{ status }}</div>
<template #footer>
@@ -28,6 +24,8 @@
</template>
<script>
import { normalizeMapSearchResults } from '@/utils/map-search';
const AMAP_KEY = '653b7cf105ad7fb8ec9b2f5198ade315';
const AMAP_SECURITY_CODE = '5aab65c632e48ebae0d0e28f5b28e21a';
let amapLoader;
@@ -42,6 +40,14 @@ export default {
type: String,
default: '',
},
longitude: {
type: [String, Number],
default: '',
},
latitude: {
type: [String, Number],
default: '',
},
},
emits: ['update:modelValue', 'confirm'],
data() {
@@ -66,9 +72,11 @@ export default {
this.visible = value;
if (value) {
this.keyword = this.address || '';
this.selected = {};
this.status = '可搜索地址或点击地图选点';
this.searchResults = [];
this.selected = this.buildInitialSelection();
this.status = this.selected.longitude
? this.selected.address || '已选点,可确认回填'
: '可搜索地址或点击地图选点';
}
},
},
@@ -82,6 +90,18 @@ export default {
}
},
methods: {
buildInitialSelection() {
const longitude = Number(this.longitude);
const latitude = Number(this.latitude);
if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {
return {};
}
return {
longitude,
latitude,
address: this.address || '',
};
},
loadAmap() {
if (window.AMap && window.AMap.Map) {
return Promise.resolve();
@@ -110,15 +130,27 @@ export default {
return new Promise(resolve => {
this.$nextTick(() => {
if (!this.$refs.map) return resolve(null);
const initial = this.buildInitialSelection();
const center =
Number.isFinite(initial.longitude) && Number.isFinite(initial.latitude)
? [initial.longitude, initial.latitude]
: [116.40769, 39.89945];
if (!this.amap) {
this.amap = new window.AMap.Map(this.$refs.map, {
center: [116.40769, 39.89945],
zoom: 11,
center,
zoom: initial.longitude ? 14 : 11,
});
this.amap.on('click', event => this.pickPoint(event.lnglat));
} else {
this.amap.resize();
this.clearMarker();
this.amap.setZoomAndCenter(initial.longitude ? 14 : 11, center);
}
if (initial.longitude) {
const point = new window.AMap.LngLat(initial.longitude, initial.latitude);
this.renderMarker(point);
this.selected = { ...initial };
this.status = initial.address || '已选点,可确认回填';
}
resolve(this.amap);
});
@@ -180,19 +212,14 @@ export default {
.then(result => {
if (!result) return;
const geocodes = result.geocodes || (result.location ? [result] : []);
this.searchResults = geocodes.map((item, index) => ({
id: item.id || index,
name: item.formattedAddress || item.address || keyword,
address: item.formattedAddress || item.address || keyword,
location: item.location,
}));
const point = geocodes[0]?.location || result.location;
this.searchResults = normalizeMapSearchResults(geocodes, keyword);
const point = this.searchResults[0]?.location || result.location;
if (!point) {
throw new Error('未找到匹配地址');
}
return this.$nextTick().then(() => {
this.amap?.resize();
this.pickPoint(point, geocodes[0]?.formattedAddress || keyword);
this.pickPoint(point, this.searchResults[0]?.address || keyword);
});
})
.catch(() => {
@@ -254,11 +281,19 @@ export default {
}
},
confirm() {
if (!this.selected.longitude || !this.selected.latitude) {
this.$message.warning('请先搜索或点击地图完成选点');
return;
}
if (!this.selected.address) {
this.$message.warning('请等待地址解析完成后再确认');
return;
}
this.$emit('confirm', this.selected.address);
this.$emit('confirm', {
address: this.selected.address,
longitude: this.selected.longitude,
latitude: this.selected.latitude,
});
this.visible = false;
},
},
@@ -278,7 +313,6 @@ export default {
}
&__map {
flex: 1 1 auto;
width: 100%;
min-width: 0;
height: 420px;
@@ -286,9 +320,19 @@ export default {
}
&__content {
display: flex;
gap: 12px;
position: relative;
display: block;
min-width: 0;
overflow: visible;
.address-map-picker__map {
position: relative;
z-index: 1;
}
:deep(.map-search-results) {
z-index: 2000;
}
}
&__info {
@@ -0,0 +1,108 @@
<template>
<el-dialog
:model-value="modelValue"
title="变更记录详情"
append-to-body
destroy-on-close
align-center
width="1100px"
class="change-record-detail-dialog"
@update:model-value="$emit('update:modelValue', $event)"
@open="resetPage"
>
<el-table
:data="pageRows"
border
max-height="60vh"
:show-overflow-tooltip="false"
>
<el-table-column prop="field" label="变更字段" min-width="180" />
<el-table-column
prop="before"
label="变更前"
min-width="360"
class-name="change-record-detail-value"
/>
<el-table-column
prop="after"
label="变更后"
min-width="500"
class-name="change-record-detail-value"
/>
</el-table>
<el-empty v-if="!total" description="暂无变更内容" :image-size="60" />
<div class="change-record-detail-dialog__pager">
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
background
:total="total"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
/>
</div>
<template #footer>
<el-button type="primary" @click="$emit('update:modelValue', false)">关闭</el-button>
</template>
</el-dialog>
</template>
<script>
export default {
name: 'ChangeRecordDetailDialog',
props: {
modelValue: {
type: Boolean,
default: false,
},
rows: {
type: Array,
default: () => [],
},
},
emits: ['update:modelValue'],
data() {
return {
currentPage: 1,
pageSize: 10,
};
},
computed: {
total() {
return this.rows.length;
},
pageRows() {
const start = (this.currentPage - 1) * this.pageSize;
return this.rows.slice(start, start + this.pageSize);
},
},
watch: {
rows() {
const maxPage = Math.max(1, Math.ceil(this.total / this.pageSize) || 1);
if (this.currentPage > maxPage) this.currentPage = 1;
},
},
methods: {
resetPage() {
this.currentPage = 1;
this.pageSize = 10;
},
},
};
</script>
<style lang="scss" scoped>
.change-record-detail-dialog__pager {
display: flex;
justify-content: flex-end;
margin-top: 12px;
}
:deep(.change-record-detail-value .cell) {
white-space: pre-wrap;
word-break: break-word;
overflow: visible;
text-overflow: clip;
line-height: 1.6;
}
</style>
+181 -22
View File
@@ -1,20 +1,55 @@
<template>
<div v-if="results.length" class="map-search-results">
<div class="map-search-results__title">搜索结果</div>
<el-empty v-if="!results.length" description="暂无搜索结果" :image-size="60" />
<div
v-for="(item, index) in results"
:key="item.id || index"
class="map-search-results__item"
@click="$emit('select', item)"
>
<div class="map-search-results__name">{{ item.name || item.address || '未命名地址' }}</div>
<div class="map-search-results__address">{{ item.address || item.name || '-' }}</div>
<div class="map-search-results__list">
<div
v-for="(item, index) in pageResults"
:key="item.id || `${currentPage}-${index}`"
class="map-search-results__item"
:class="{ 'is-active': isActive(item, index) }"
@click="handleSelect(item, index)"
>
<img
v-if="item.photo || item.image"
class="map-search-results__thumb"
:src="item.photo || item.image"
alt=""
/>
<div class="map-search-results__body">
<div class="map-search-results__name">
{{ item.name || item.address || '未命名地址' }}
</div>
<div class="map-search-results__address">
地址:{{ item.address || item.name || '-' }}
</div>
</div>
</div>
</div>
<div v-if="totalPages > 1" class="map-search-results__pager">
<button
v-for="page in visiblePages"
:key="page"
type="button"
class="map-search-results__page"
:class="{ 'is-active': page === currentPage }"
@click="currentPage = page"
>
{{ page }}
</button>
<button
type="button"
class="map-search-results__page map-search-results__page--next"
:disabled="currentPage >= totalPages"
@click="goNext"
>
下一页
</button>
</div>
</div>
</template>
<script>
const PAGE_SIZE = 5;
export default {
props: {
results: {
@@ -23,43 +58,167 @@ export default {
},
},
emits: ['select'],
data() {
return {
currentPage: 1,
activeKey: '',
};
},
computed: {
totalPages() {
return Math.max(1, Math.ceil((this.results || []).length / PAGE_SIZE));
},
pageResults() {
const start = (this.currentPage - 1) * PAGE_SIZE;
return (this.results || []).slice(start, start + PAGE_SIZE);
},
visiblePages() {
const maxButtons = 3;
let start = Math.max(1, this.currentPage - 1);
let end = Math.min(this.totalPages, start + maxButtons - 1);
start = Math.max(1, end - maxButtons + 1);
const pages = [];
for (let page = start; page <= end; page += 1) {
pages.push(page);
}
return pages;
},
},
watch: {
results() {
this.currentPage = 1;
this.activeKey = '';
},
},
methods: {
resultKey(item, index) {
return item?.id ?? `${this.currentPage}-${index}`;
},
isActive(item, index) {
return this.activeKey === this.resultKey(item, index);
},
handleSelect(item, index) {
this.activeKey = this.resultKey(item, index);
this.$emit('select', item);
},
goNext() {
if (this.currentPage < this.totalPages) {
this.currentPage += 1;
}
},
},
};
</script>
<style lang="scss" scoped>
.map-search-results {
width: 260px;
height: 420px;
overflow-y: auto;
border: 1px solid #eff1f7;
position: absolute;
top: 0;
left: 0;
z-index: 2000;
display: flex;
flex-direction: column;
width: 360px;
max-height: 360px;
overflow: hidden;
background: #fff;
flex: 0 0 260px;
border: 1px solid #dcdfe6;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
pointer-events: auto;
&__title {
padding: 10px 12px;
border-bottom: 1px solid #eff1f7;
font-weight: 600;
&__list {
flex: 1 1 auto;
min-height: 0;
overflow-y: auto;
}
&__item {
display: flex;
gap: 10px;
align-items: flex-start;
padding: 10px 12px;
cursor: pointer;
border-bottom: 1px solid #f5f5f5;
border-bottom: 1px solid #ebeef5;
}
&__item:hover {
background: #f5f9ff;
&__item:hover,
&__item.is-active {
background: #f5f5f5;
}
&__thumb {
flex: 0 0 48px;
width: 48px;
height: 48px;
object-fit: cover;
border: 1px solid #ebeef5;
background: #fafafa;
}
&__body {
flex: 1 1 auto;
min-width: 0;
}
&__name {
overflow: hidden;
color: #303133;
font-size: 14px;
font-weight: 600;
line-height: 1.4;
white-space: nowrap;
text-overflow: ellipsis;
}
&__address {
margin-top: 4px;
color: #909399;
font-size: 12px;
line-height: 1.5;
word-break: break-all;
}
&__pager {
display: flex;
flex: 0 0 auto;
flex-wrap: wrap;
gap: 6px;
align-items: center;
padding: 8px 10px;
border-top: 1px solid #ebeef5;
background: #fff;
}
&__page {
min-width: 28px;
height: 28px;
padding: 0 8px;
color: #606266;
font-size: 13px;
line-height: 26px;
text-align: center;
background: #fff;
border: 1px solid #dcdfe6;
cursor: pointer;
&:hover:not(:disabled) {
color: #409eff;
border-color: #409eff;
}
&.is-active {
color: #409eff;
border-color: #409eff;
}
&:disabled {
color: #c0c4cc;
cursor: not-allowed;
}
&--next {
min-width: 56px;
}
}
}
</style>
@@ -212,7 +212,14 @@ export default {
.filter(Boolean);
},
acceptText() {
return this.acceptedList.join(',');
return this.acceptedList
.map(item => {
const value = String(item).trim();
if (!value || value.includes('/') || value.startsWith('.')) return value;
return `.${value}`;
})
.filter(Boolean)
.join(',');
},
tipText() {
return this.tip || `${UNIFIED_ATTACHMENT_TIP_PREFIX}${this.maxSize}M`;
@@ -304,12 +311,22 @@ export default {
});
},
handleSuccess(response, file, files) {
if (!response || response.success === false || (response.code && response.code !== 200)) {
const code = response?.code;
const codeInvalid = code !== undefined && code !== null && code !== '' && Number(code) !== 200;
if (!response || response.success === false || codeInvalid) {
this.$message.error((response && response.msg) || '上传失败');
return;
}
this.emitUploadFiles(this.multiple ? files : [file]);
this.$emit('success', this.normalizeUploadFile(file));
if (file && !file.response) {
file.response = response;
}
const normalized = this.normalizeUploadFile(file, response);
if (!normalized.url) {
this.$message.error('上传成功但未返回文件地址');
return;
}
this.$emit('success', normalized);
this.emitUploadFiles(this.multiple ? files : [file], normalized);
this.$message.success('上传成功');
},
handleChange(file, files) {
@@ -323,35 +340,89 @@ export default {
this.emitUploadFiles(files);
return true;
},
emitUploadFiles(files) {
const list = files
.filter(file => file.status === 'success' || this.getFileUrl(file))
.map(this.normalizeUploadFile)
emitUploadFiles(files, preferredFile) {
const list = (files || [])
.filter(file => {
if (file?.status === 'fail') return false;
return (
file?.status === 'success' ||
this.getFileUrl(file) ||
file?.response?.data ||
file?.response?.link ||
file?.response
);
})
.map(file => this.normalizeUploadFile(file))
.filter(item => item.url);
this.$emit('update:modelValue', list);
this.$emit('change', list);
if (preferredFile?.url) {
const exists = list.some(
item =>
(preferredFile.uid && item.uid && String(item.uid) === String(preferredFile.uid)) ||
item.url === preferredFile.url
);
if (!exists) list.push(preferredFile);
}
const current = this.parseValue(this.modelValue).map(item => ({
...item,
url: this.getFileUrl(item),
}));
const merged = [...current];
list.forEach(file => {
const index = merged.findIndex(
item =>
(file.uid && item.uid && String(item.uid) === String(file.uid)) ||
(file.url && this.getFileUrl(item) === file.url)
);
if (index >= 0) merged.splice(index, 1, { ...merged[index], ...file });
else merged.push(file);
});
const result = merged.filter(item => this.getFileUrl(item));
this.$emit('update:modelValue', result);
this.$emit('change', result);
},
normalizeUploadFile(file) {
const data = (file.response && file.response.data) || file.data || file;
const url = data.link || data.url || data.domain || file.url || '';
normalizeUploadFile(file, responseOverride) {
const response = responseOverride || file?.response;
let data = {};
if (response && typeof response === 'object') {
if (response.data && typeof response.data === 'object') {
data = response.data;
} else if (response.link || response.url || response.domain) {
data = response;
}
}
if (!data.link && !data.url && !data.domain) {
data = file?.data && typeof file.data === 'object' ? file.data : file || {};
}
const url =
data.link ||
data.url ||
data.domain ||
data.fileLink ||
data.fileUrl ||
file?.url ||
file?.link ||
'';
const originalName =
data.originalName ||
file.originalName ||
file.name ||
file?.originalName ||
file?.name ||
data.name ||
this.getFileName(url) ||
'附件';
const extension = this.getExtension({ name: originalName, url });
return {
...data,
uid: file.uid || data.uid,
uid: file?.uid || data.uid,
originalName,
name: originalName,
url,
link: data.link || url,
size: data.size || data.attachSize || file.size || '',
size: data.size || data.attachSize || file?.size || '',
extension,
mimeType: data.mimeType || data.contentType || file.raw?.type || MIME_MAP[extension] || '',
mimeType: data.mimeType || data.contentType || file?.raw?.type || MIME_MAP[extension] || '',
};
},
handlePreview(file) {
+1
View File
@@ -1,6 +1,7 @@
FROM nginx
VOLUME /tmp
ENV LANG en_US.UTF-8
ADD ./src/docker/nginx.conf /etc/nginx/conf.d/default.conf
ADD ./dist/ /usr/share/nginx/html/
EXPOSE 80
EXPOSE 443
+19
View File
@@ -0,0 +1,19 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
location /assets/ {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
location / {
add_header Cache-Control "no-store, no-cache, must-revalidate";
try_files $uri $uri/ /index.html;
}
}
+4
View File
@@ -1,8 +1,12 @@
import store from './store';
import { isChunkLoadError, reloadForChunkError } from './utils/chunk-reload';
export default {
install: app => {
app.config.errorHandler = (err, vm, info) => {
if (isChunkLoadError(err) && reloadForChunkError()) {
return;
}
store.commit('ADD_LOGS', {
type: 'error',
message: err.message,
+2
View File
@@ -1,4 +1,5 @@
import { createApp } from 'vue';
import { installChunkReload } from './utils/chunk-reload';
import website from './config/website';
import axios from './axios';
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';
window.$crudCommon = crudCommon;
installChunkReload();
debug();
window.axios = axios;
const app = createApp(App);
+15
View File
@@ -38,6 +38,21 @@ export const createOption = () => ({
menuWidth: 240,
menuFixed: 'right',
column: [
{
label: '计量单位编码',
prop: 'unitCode',
minWidth: 150,
span: 24,
search: true,
searchOrder: 4,
searchSpan: 6,
maxlength: 50,
showWordLimit: true,
rules: [
{ required: true, message: '请输入计量单位编码', trigger: 'blur' },
{ max: 50, message: '计量单位编码不能超过50个字', trigger: 'blur' },
],
},
{
label: '计量单位',
prop: 'unitName',
+18 -16
View File
@@ -55,8 +55,8 @@ export const config = {
'templateType',
'transportType',
'createUserName',
'remark',
'updateTime',
'remark',
'createTime',
],
exportColumns: [
@@ -65,8 +65,8 @@ export const config = {
{ prop: 'templateType', label: '模板类型' },
{ prop: 'transportType', label: '运输方式' },
{ prop: 'createUserName', label: '创建人' },
{ prop: 'remark', label: '备注' },
{ prop: 'updateTime', label: '更新时间' },
{ prop: 'remark', label: '备注' },
{ prop: 'createTime', label: '创建时间' },
],
enableAllDept: false,
@@ -82,12 +82,14 @@ export const config = {
detailAttachmentDescriptionPlain: true,
enableTransportPlanForm: true,
enableShippingTemplateFreight: true,
editableRoadAddress: true,
editableRoadAddress: false,
fixedTransportAddressType: true,
enableTemplateCodePreview: true,
attachmentTitle: '附件',
defaultForm: {
templateType: '运输计划',
transportType: '公路运输',
transportTypeName: '公路运输',
},
transportFormRequiredFields: [
['projectName', '项目'],
@@ -119,15 +121,16 @@ export const option = {
labelWidth: 0,
},
{
label: '模板编号',
prop: 'templateCode',
label: '模板类型',
prop: 'templateType',
type: 'select',
search: true,
searchOrder: 4,
searchOrder: 2,
span: 8,
order: 390,
minWidth: 170,
disabled: true,
placeholder: '系统自动生成',
dicData: templateTypeOptions,
minWidth: 120,
rules: selectRule('模板类型'),
display: true,
},
{
@@ -142,16 +145,15 @@ export const option = {
display: true,
},
{
label: '模板类型',
prop: 'templateType',
type: 'select',
label: '模板编号',
prop: 'templateCode',
search: true,
searchOrder: 2,
searchOrder: 4,
span: 8,
order: 370,
dicData: templateTypeOptions,
minWidth: 120,
rules: selectRule('模板类型'),
minWidth: 170,
disabled: true,
placeholder: '系统自动生成',
display: true,
},
{
@@ -334,7 +334,7 @@ export const option = {
},
...auditColumns.map(column => ({ ...column, hide: true })),
])),
dialogWidth: '96%',
dialogWidth: 1100,
menuFixed: 'right',
menuWidth: 320,
index: false,
+6 -4
View File
@@ -209,12 +209,12 @@ export const config = {
attachmentTitle: '附件',
searchRangeMap: {
planStartDateRange: ['planStartDateStart', 'planStartDateEnd'],
planEndDateRange: ['planEndDateStart', 'planEndDateEnd'],
createTimeRange: ['createTimeStart', 'createTimeEnd', '00:00:00', '23:59:59'],
},
actions: ['copy', 'complete'],
statusProp: 'businessStatus',
statusTextProp: 'businessStatusName',
deleteStatus: ['draft', 'waiting_dispatch'],
deleteStatus: ['draft'],
editStatus: ['draft', 'waiting_dispatch', 'dispatching'],
detailButton: true,
detailSections: [
@@ -341,6 +341,7 @@ export const option = {
{
label: '发货地址',
prop: 'departureAddress',
slot: true,
formslot: true,
search: true,
searchOrder: 7,
@@ -352,6 +353,7 @@ export const option = {
{
label: '到货地址',
prop: 'arrivalAddress',
slot: true,
formslot: true,
search: true,
searchOrder: 6,
@@ -577,8 +579,8 @@ export const option = {
viewDisplay: false,
},
{
label: '计划结束日期',
prop: 'planEndDateRange',
label: '创建时间',
prop: 'createTimeRange',
type: 'date',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
+7 -1
View File
@@ -543,7 +543,8 @@ export const option = {
prop: 'projectName',
formslot: true,
search: true,
searchLabel: '项目',
searchLabel: '项目名称',
searchPlaceholder: '请选择或输入',
searchOrder: 22,
span: 6,
order: 890,
@@ -555,6 +556,7 @@ export const option = {
prop: 'customerName',
search: true,
searchLabel: '客户名称',
searchPlaceholder: '请选择或输入',
searchOrder: 21,
minWidth: 150,
addDisplay: false,
@@ -576,6 +578,7 @@ export const option = {
prop: 'driverName',
search: true,
searchLabel: '司机名称',
searchPlaceholder: '请选择或输入',
searchOrder: 14,
minWidth: 120,
display: false,
@@ -626,6 +629,7 @@ export const option = {
prop: 'carrierName',
search: true,
searchLabel: '承运商名称',
searchPlaceholder: '请选择或输入',
searchOrder: 15,
minWidth: 150,
display: false,
@@ -729,6 +733,7 @@ export const option = {
prop: 'planName',
formslot: true,
search: true,
searchPlaceholder: '请选择或输入',
searchOrder: 7,
span: 6,
order: 870,
@@ -738,6 +743,7 @@ export const option = {
label: '货物类型',
prop: 'cargoType',
search: true,
searchPlaceholder: '请选择或输入',
searchOrder: 18,
formatter: row => formatGoodsField(row, ['cargoType', 'goodsType', 'typeName']),
minWidth: 130,
+3 -2
View File
@@ -5,6 +5,7 @@ export const GRANT_TYPE_DIC = [
{ label: '社交登录', value: 'social' },
{ label: '客户端凭证', value: 'client_credentials' },
{ label: '刷新令牌', value: 'refresh_token' },
{ label: '退出登录', value: 'logout' },
];
export const authLogOption = {
@@ -38,7 +39,7 @@ export const authLogOption = {
prop: 'realName',
},
{
label: '授权类型',
label: '操作类型',
prop: 'grantType',
type: 'select',
search: true,
@@ -80,7 +81,7 @@ export const authLogOption = {
width: 120,
},
{
label: '登录时间',
label: '操作时间',
prop: 'loginTime',
sortable: true,
span: 24,
+2 -5
View File
@@ -1,12 +1,9 @@
import { getDeptLazyTree } from '@/api/system/dept';
import { validateLoginPassword } from '@/utils/validate';
export const userOption = safe => {
const validatePass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入密码'));
} else {
callback();
}
validateLoginPassword(rule, value, callback);
};
const validatePass2 = (rule, value, callback) => {
if (value === '') {
+12 -1
View File
@@ -1,7 +1,18 @@
<template>
<router-view #="{ Component }">
<keep-alive :include="$store.getters.tagsKeep">
<component :is="Component" />
<component :is="tabView($route, Component)" />
</keep-alive>
</router-view>
</template>
<script>
import { tabView } from '@/router/tab';
export default {
name: 'layout',
methods: {
tabView,
},
};
</script>
+2 -2
View File
@@ -13,8 +13,8 @@ export default {
data() {
return {
loginForm: {
username: 'admin',
password: '123456',
username: '',
password: '',
},
};
},
+3 -1
View File
@@ -24,6 +24,7 @@
-->
<userLogin v-if="activeName === 'user'"></userLogin>
<registerLogin v-else-if="activeName === 'register'"></registerLogin>
<!-- 暂时默认账号密码登录,IAM 选择入口先隐藏
<div v-else class="iam-login">
<el-button type="primary" class="login-submit" @click.prevent="handleIamLogin">
IAM统一身份认证
@@ -32,6 +33,7 @@
账号密码登录
</el-button>
</div>
-->
</div>
</div>
</div>
@@ -61,7 +63,7 @@ export default {
return {
website: website,
time: '',
activeName: 'iam',
activeName: 'user',
socialForm: {
tenantId: '000000',
source: '',
+2 -2
View File
@@ -93,9 +93,9 @@ export default {
//角色ID
roleId: '',
//用户名
username: 'admin',
username: '',
//密码
password: 'admin',
password: '',
//账号类型
type: 'account',
//验证码的值
+13 -10
View File
@@ -3,6 +3,8 @@ import store from './store';
import { tabKeyOf } from '@/router/tab';
import { getToken } from '@/utils/auth';
import {
consumeReloadQuery,
hasReloadQuery,
isChunkLoadError,
reloadForChunkError,
setPendingRoutePath,
@@ -17,19 +19,20 @@ const lockPage = '/lock'; //锁屏页
router.onError(error => {
if (!isChunkLoadError(error)) return;
if (reloadForChunkError()) {
ElMessage.warning('页面资源加载失败,正在重新加载…');
}
});
window.addEventListener('unhandledrejection', event => {
if (!isChunkLoadError(event.reason)) return;
if (reloadForChunkError()) {
event.preventDefault();
ElMessage.warning('页面资源加载失败,正在重新加载…');
ElMessage.warning('页面资源已更新,正在重新加载…');
}
});
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);
const meta = to.meta || {};
const isMenu = meta.menu === undefined ? to.query.menu : meta.menu;
@@ -59,7 +62,7 @@ router.beforeEach((to, from, next) => {
fullPath: tabKeyOf(to),
params: to.params,
query: to.query,
meta: meta,
meta: { ...meta, keepAlive: true },
});
}
next();
+15 -10
View File
@@ -2,6 +2,9 @@ import website from '@/config/website';
import { getToken } from '@/utils/auth';
import store from '@/store';
import { generateIframePath, processUrlForQuery, isURL } from './router';
import { wrapViewLoader } from '@/utils/chunk-reload';
// 保持懒加载,避免 eager 与 store 循环依赖(Cannot access 'store' before initialization)
const modules = import.meta.glob('../**/**/*.vue');
// 将多级路由扁平化为二级路由,支持 keep-alive 跨层级缓存
@@ -96,21 +99,23 @@ RouterPlugin.install = function (option = {}) {
component: (() => {
// 判断是否为首路由
if (first) {
return modules[
option.store.getters.isMacOs || !website.setting.menu
? '../page/index/layout.vue'
: '../page/index/index.vue'
];
return wrapViewLoader(
modules[
option.store.getters.isMacOs || !website.setting.menu
? '../page/index/layout.vue'
: '../page/index/index.vue'
]
);
// 判断是否为多层路由
} else if (isChild && !first) {
return modules['../page/index/layout.vue'];
return wrapViewLoader(modules['../page/index/layout.vue']);
// 判断是否为最终的页面视图
} else {
let result = modules[`../${component}.vue`];
if (!result) {
isComponent = false;
}
return result;
return wrapViewLoader(result);
}
})(),
name,
@@ -127,7 +132,7 @@ RouterPlugin.install = function (option = {}) {
if (first) {
oMenu[propsDefault.path] = `${path}`;
let componentPath = oMenu.component || component;
let result = modules[`../${componentPath}.vue`];
let result = wrapViewLoader(modules[`../${componentPath}.vue`]);
if (!result) {
isComponent = false;
}
@@ -173,7 +178,7 @@ export const formatPath = (ele, first) => {
const icon = ele[propsDefault.icon];
ele[propsDefault.icon] = icon || '';
ele.meta = {
keepAlive: ele.isOpen === 2,
keepAlive: true,
};
const iframeComponent = 'components/iframe/main';
const iframeSrc = href => {
@@ -215,7 +220,7 @@ export const formatPath = (ele, first) => {
ele[propsDefault.children].forEach(child => {
child.component = 'views' + child[propsDefault.path];
child.meta = {
keepAlive: child.isOpen === 2,
keepAlive: true,
};
if (isURL(child[propsDefault.href])) {
let href = child[propsDefault.href];
+76
View File
@@ -74,6 +74,82 @@ export default [
isAuth: false,
},
},
{
path: '/vehicle/customer-archive/public-view',
name: '查看客商信息',
component: () => import('@/views/vehicle/customer-archive-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
},
},
{
path: '/business/project-apply/public-view',
name: '查看项目信息',
component: () => import('@/views/business/project-apply-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
bizType: 'project-apply',
},
},
{
path: '/business/contract-manage/public-view',
name: '查看合同信息',
component: () => import('@/views/business/contract-manage-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
bizType: 'contract-manage',
},
},
{
path: '/business/waybill-manage/public-view',
name: '查看运单信息',
component: () => import('@/views/business/waybill-manage-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
bizType: 'waybill-manage',
},
},
{
path: '/settlement/pre-settlement/public-view',
name: '查看预结算信息',
component: () => import('@/views/settlement/pre-settlement-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
bizType: 'pre-settlement',
},
},
{
path: '/settlement/formal-settlement/public-view',
name: '查看正式结算信息',
component: () => import('@/views/settlement/formal-settlement-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
bizType: 'formal-settlement',
},
},
{
path: '/payment/payment-application/public-view',
name: '查看付款申请信息',
component: () => import('@/views/payment/payment-application-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
bizType: 'payment-application',
},
},
{
path: '/',
name: '主页',
+1 -1
View File
@@ -128,5 +128,5 @@ export function tabView(route, Component) {
};
wrapperMap.set(tabKey, wrapper);
}
return h(wrapper);
return wrapper;
}
+58 -38
View File
@@ -1,5 +1,8 @@
import Layout from '@/page/index/index.vue';
import Store from '@/store/';
import { wrapViewLoader } from '@/utils/chunk-reload';
const loadView = loader => wrapViewLoader(loader);
export default [
{
@@ -10,7 +13,7 @@ export default [
path: '',
name: '汇票付款表单',
meta: { keepAlive: false, activeMenu: '/payment/bill-payment' },
component: () => import('@/views/payment/bill-payment-form.vue'),
component: loadView(() => import('@/views/payment/bill-payment-form.vue')),
},
],
},
@@ -22,7 +25,7 @@ export default [
path: '',
name: '汇票台账表单',
meta: { keepAlive: false, activeMenu: '/payment/bill-ledger' },
component: () => import('@/views/payment/bill-ledger-form.vue'),
component: loadView(() => import('@/views/payment/bill-ledger-form.vue')),
},
],
},
@@ -34,7 +37,7 @@ export default [
path: '',
name: '认领记录详情',
meta: { keepAlive: false, activeMenu: '/payment/receipt-claim-record' },
component: () => import('@/views/payment/receipt-claim-record-form.vue'),
component: loadView(() => import('@/views/payment/receipt-claim-record-form.vue')),
},
],
},
@@ -46,7 +49,7 @@ export default [
path: '',
name: '收款流水认领',
meta: { keepAlive: false, activeMenu: '/payment/receipt-flow' },
component: () => import('@/views/payment/receipt-flow-form.vue'),
component: loadView(() => import('@/views/payment/receipt-flow-form.vue')),
},
],
},
@@ -58,7 +61,7 @@ export default [
path: '',
name: '收票登记',
meta: { keepAlive: false, activeMenu: '/payment/invoice-receipt' },
component: () => import('@/views/payment/invoice-receipt-form.vue'),
component: loadView(() => import('@/views/payment/invoice-receipt-form.vue')),
},
],
},
@@ -70,7 +73,7 @@ export default [
path: '',
name: '开票申请',
meta: { keepAlive: false, activeMenu: '/payment/invoice-application' },
component: () => import('@/views/payment/invoice-application-form.vue'),
component: loadView(() => import('@/views/payment/invoice-application-form.vue')),
},
],
},
@@ -82,7 +85,7 @@ export default [
path: '',
name: '付款申请',
meta: { keepAlive: false, activeMenu: '/payment/payment-application' },
component: () => import('@/views/payment/payment-application-form.vue'),
component: loadView(() => import('@/views/payment/payment-application-form.vue')),
},
],
},
@@ -97,7 +100,7 @@ export default [
keepAlive: false,
activeMenu: '/settlement/pre-settlement',
},
component: () => import('@/views/settlement/pre-settlement-form.vue'),
component: loadView(() => import('@/views/settlement/pre-settlement-form.vue')),
},
],
},
@@ -112,7 +115,7 @@ export default [
keepAlive: false,
activeMenu: '/settlement/formal-settlement',
},
component: () => import('@/views/settlement/formal-settlement-form.vue'),
component: loadView(() => import('@/views/settlement/formal-settlement-form.vue')),
},
],
},
@@ -127,7 +130,7 @@ export default [
keepAlive: false,
activeMenu: '/settlement/transport-reconciliation',
},
component: () => import('@/views/settlement/transport-reconciliation-form.vue'),
component: loadView(() => import('@/views/settlement/transport-reconciliation-form.vue')),
},
],
},
@@ -139,7 +142,7 @@ export default [
path: '',
name: '执行凭证批次详情',
meta: { keepAlive: false, activeMenu: '/business/voucher-manage' },
component: () => import('@/views/business/voucher-manage-detail.vue'),
component: loadView(() => import('@/views/business/voucher-manage-detail.vue')),
},
],
},
@@ -151,7 +154,7 @@ export default [
path: '',
name: '新增合同管理',
meta: { keepAlive: false },
component: () => import('@/views/business/contract-manage.vue'),
component: loadView(() => import('@/views/business/contract-manage.vue')),
},
],
},
@@ -163,7 +166,7 @@ export default [
path: '',
name: '合同详情',
meta: { keepAlive: false, activeMenu: '/business/contract-manage' },
component: () => import('@/views/business/contract-manage.vue'),
component: loadView(() => import('@/views/business/contract-manage.vue')),
},
],
},
@@ -175,7 +178,7 @@ export default [
path: '',
name: '新增项目申请',
meta: { keepAlive: false },
component: () => import('@/views/business/project-apply.vue'),
component: loadView(() => import('@/views/business/project-apply.vue')),
},
],
},
@@ -187,7 +190,7 @@ export default [
path: '',
name: '新增编辑运单管理',
meta: { keepAlive: false },
component: () => import('@/views/business/waybill-manage.vue'),
component: loadView(() => import('@/views/business/waybill-manage.vue')),
},
],
},
@@ -199,7 +202,7 @@ export default [
path: '',
name: '运单管理详情',
meta: { keepAlive: false, activeMenu: '/business/waybill-manage' },
component: () => import('@/views/business/waybill-manage-detail.vue'),
component: loadView(() => import('@/views/business/waybill-manage-detail.vue')),
},
],
},
@@ -211,7 +214,7 @@ export default [
path: '',
name: '导入运单',
meta: { keepAlive: false, activeMenu: '/business/waybill-import' },
component: () => import('@/views/business/waybill-import.vue'),
component: loadView(() => import('@/views/business/waybill-import.vue')),
},
],
},
@@ -223,7 +226,7 @@ export default [
path: '',
name: '新建导入运单',
meta: { keepAlive: false, activeMenu: '/business/waybill-import' },
component: () => import('@/views/business/waybill-import-form.vue'),
component: loadView(() => import('@/views/business/waybill-import-form.vue')),
},
],
},
@@ -235,6 +238,18 @@ export default [
path: '',
name: '新增编辑配载管理',
meta: { keepAlive: false },
component: loadView(() => import('@/views/business/loading-manage.vue')),
},
],
},
{
path: '/business/loading-manage/detail',
component: Layout,
children: [
{
path: '',
name: '配载单详情',
meta: { keepAlive: false, activeMenu: '/business/loading-manage' },
component: () => import('@/views/business/loading-manage.vue'),
},
],
@@ -247,7 +262,7 @@ export default [
path: '',
name: '新增编辑运输计划',
meta: { keepAlive: false },
component: () => import('@/views/business/transport-plan.vue'),
component: loadView(() => import('@/views/business/transport-plan.vue')),
},
],
},
@@ -259,7 +274,7 @@ export default [
path: '',
name: '导入运输计划',
meta: { keepAlive: false, activeMenu: '/business/transport-plan' },
component: () => import('@/views/business/transport-plan-import.vue'),
component: loadView(() => import('@/views/business/transport-plan-import.vue')),
},
],
},
@@ -271,7 +286,7 @@ export default [
path: '',
name: '计划调度',
meta: { keepAlive: false, activeMenu: '/business/transport-plan' },
component: () => import('@/views/business/transport-plan-dispatch.vue'),
component: loadView(() => import('@/views/business/transport-plan-dispatch.vue')),
},
],
},
@@ -283,7 +298,7 @@ export default [
path: '',
name: '新增编辑运单模板',
meta: { keepAlive: false },
component: () => import('@/views/business/shipping-template.vue'),
component: loadView(() => import('@/views/business/shipping-template.vue')),
},
],
},
@@ -295,7 +310,7 @@ export default [
path: '',
name: '新增客商档案',
meta: { keepAlive: false },
component: () => import('@/views/vehicle/customer-archive.vue'),
component: loadView(() => import('@/views/vehicle/customer-archive.vue')),
},
],
},
@@ -307,7 +322,7 @@ export default [
path: '',
name: '合同变更',
meta: { keepAlive: false },
component: () => import('@/views/business/contract-manage-change.vue'),
component: loadView(() => import('@/views/business/contract-manage-change.vue')),
},
],
},
@@ -323,7 +338,7 @@ export default [
meta: {
i18n: 'dashboard',
},
component: () => import(/* webpackChunkName: "views" */ '@/views/wel/index.vue'),
component: loadView(() => import(/* webpackChunkName: "views" */ '@/views/wel/index.vue')),
},
{
path: 'dashboard',
@@ -332,7 +347,7 @@ export default [
i18n: 'dashboard',
menu: false,
},
component: () => import(/* webpackChunkName: "views" */ '@/views/wel/dashboard.vue'),
component: loadView(() => import(/* webpackChunkName: "views" */ '@/views/wel/dashboard.vue')),
},
],
},
@@ -347,7 +362,7 @@ export default [
meta: {
i18n: 'test',
},
component: () => import(/* webpackChunkName: "views" */ '@/views/util/test.vue'),
component: loadView(() => import(/* webpackChunkName: "views" */ '@/views/util/test.vue')),
},
],
},
@@ -362,8 +377,9 @@ export default [
meta: {
i18n: 'dict',
},
component: () =>
import(/* webpackChunkName: "views" */ '@/views/util/demo/dict-horizontal.vue'),
component: loadView(() =>
import(/* webpackChunkName: "views" */ '@/views/util/demo/dict-horizontal.vue')
),
},
],
},
@@ -378,8 +394,9 @@ export default [
meta: {
i18n: 'dict',
},
component: () =>
import(/* webpackChunkName: "views" */ '@/views/util/demo/dict-vertical.vue'),
component: loadView(() =>
import(/* webpackChunkName: "views" */ '@/views/util/demo/dict-vertical.vue')
),
},
],
},
@@ -394,7 +411,7 @@ export default [
meta: {
i18n: 'info',
},
component: () => import(/* webpackChunkName: "views" */ '@/views/system/userinfo.vue'),
component: loadView(() => import(/* webpackChunkName: "views" */ '@/views/system/userinfo.vue')),
},
],
},
@@ -409,8 +426,9 @@ export default [
meta: {
i18n: 'work',
},
component: () =>
import(/* webpackChunkName: "views" */ '@/views/work/process/leave/form.vue'),
component: loadView(() =>
import(/* webpackChunkName: "views" */ '@/views/work/process/leave/form.vue')
),
},
{
path: 'handle/:taskId/:processInstanceId/:businessId',
@@ -418,8 +436,9 @@ export default [
meta: {
i18n: 'work',
},
component: () =>
import(/* webpackChunkName: "views" */ '@/views/work/process/leave/handle.vue'),
component: loadView(() =>
import(/* webpackChunkName: "views" */ '@/views/work/process/leave/handle.vue')
),
},
{
path: 'detail/:processInstanceId/:businessId',
@@ -427,8 +446,9 @@ export default [
meta: {
i18n: 'work',
},
component: () =>
import(/* webpackChunkName: "views" */ '@/views/work/process/leave/detail.vue'),
component: loadView(() =>
import(/* webpackChunkName: "views" */ '@/views/work/process/leave/detail.vue')
),
},
],
},
+2 -5
View File
@@ -16,11 +16,8 @@ const getters = {
lockPasswd: state => state.common.lockPasswd,
tagList: state => state.tags.tagList,
tagsKeep: (state, getters) => {
return getters.tagList
.filter(ele => {
return (ele.meta || {}).keepAlive;
})
.map(ele => ele.fullPath);
// 所有已打开标签均纳入 keep-alive,关闭标签后自动从白名单移除并释放实例
return getters.tagList.map(ele => ele.fullPath).filter(Boolean);
},
tagWel: state => state.tags.tagWel,
token: state => state.user.token,
+10 -3
View File
@@ -150,12 +150,15 @@ a {
bottom: 0;
}
.map-picker-content {
display: flex;
gap: 12px;
position: relative;
display: block;
min-width: 0;
overflow: visible;
> [class$='__map'],
> .address-map {
flex: 1 1 auto;
position: relative;
z-index: 1;
width: 100%;
min-width: 0;
box-sizing: border-box;
@@ -165,4 +168,8 @@ a {
height: 100% !important;
}
}
> .map-search-results {
z-index: 2000;
}
}
+140
View File
@@ -0,0 +1,140 @@
import { getDetail, getList as getCustomerList } from '@/api/vehicle/customer-archive';
import { getList as getDriverList } from '@/api/transportCapacity/driver';
import { getList as getVehicleList } from '@/api/transportCapacity/transport-vehicle';
const orgNameCache = new Map();
const extractRecords = res => {
const data = res?.data?.data ?? res?.data ?? res;
if (Array.isArray(data)) return data;
if (Array.isArray(data?.records)) return data.records;
if (Array.isArray(data?.data)) return data.data;
return [];
};
const normalizeOrgName = value => String(value || '').trim();
const uniqueOrgNames = (values = []) => {
const seen = new Set();
const result = [];
values.forEach(value => {
const name = normalizeOrgName(value);
if (!name || seen.has(name)) return;
seen.add(name);
result.push(name);
});
return result;
};
/**
* 解析承运商客商档案上联系人的所属组织(branchName),无联系人时回退客商所属组织。
*/
export const resolveCarrierOrganizationNames = async ({ carrierId, carrierName } = {}) => {
const id = String(carrierId || '').trim();
const name = normalizeOrgName(carrierName);
const cacheKey = id || name;
if (!cacheKey) return [];
if (orgNameCache.has(cacheKey)) return orgNameCache.get(cacheKey);
let detail = null;
if (id) {
try {
const res = await getDetail(id);
detail = res?.data?.data || res?.data || null;
} catch (error) {
detail = null;
}
}
if (!detail && name) {
try {
const res = await getCustomerList(1, 20, { fullName: name });
const records = extractRecords(res);
const matched =
records.find(item => normalizeOrgName(item.fullName || item.customerName) === name) ||
records[0];
if (matched?.id) {
const detailRes = await getDetail(matched.id);
detail = detailRes?.data?.data || detailRes?.data || matched;
}
} catch (error) {
detail = null;
}
}
const contacts = Array.isArray(detail?.contacts) ? detail.contacts : [];
const orgNames = uniqueOrgNames([
...contacts.map(item => item.branchName),
detail?.deptName,
detail?.organizationName,
]);
orgNameCache.set(cacheKey, orgNames);
if (id && name) orgNameCache.set(name, orgNames);
return orgNames;
};
export const clearCarrierOrganizationCache = (carrier = {}) => {
const id = String(carrier.carrierId || '').trim();
const name = normalizeOrgName(carrier.carrierName);
if (id) orgNameCache.delete(id);
if (name) orgNameCache.delete(name);
};
export const matchOrganizationName = (value, orgNames = []) => {
const text = normalizeOrgName(value);
if (!text || !orgNames.length) return false;
return orgNames.some(org => text === org || text.includes(org) || org.includes(text));
};
const filterByOrganizations = (records = [], orgNames = []) => {
if (!orgNames.length) return [];
return records.filter(item => matchOrganizationName(item.organizationName, orgNames));
};
/**
* 按承运商联系人所属组织筛选司机。
* 未选择承运商时返回空列表(需先选承运商)。
*/
export const fetchDriversByCarrierOrganizations = async (
query = {},
{ carrierId, carrierName } = {}
) => {
if (!String(carrierId || '').trim() && !normalizeOrgName(carrierName)) {
return [];
}
const orgNames = await resolveCarrierOrganizationNames({ carrierId, carrierName });
if (!orgNames.length) return [];
const size = Math.max(Number(query.size) || 50, 50);
const params = { ...query };
delete params.size;
// 单组织时用后端模糊条件缩小范围;多组织再前端精确过滤
if (orgNames.length === 1) {
params.organizationName = orgNames[0];
}
const res = await getDriverList(1, Math.min(size * 5, 200), params);
return filterByOrganizations(extractRecords(res), orgNames).slice(0, size);
};
/**
* 按承运商联系人所属组织筛选车辆。
* 未选择承运商时返回空列表。
*/
export const fetchVehiclesByCarrierOrganizations = async (
query = {},
{ carrierId, carrierName } = {}
) => {
if (!String(carrierId || '').trim() && !normalizeOrgName(carrierName)) {
return [];
}
const orgNames = await resolveCarrierOrganizationNames({ carrierId, carrierName });
if (!orgNames.length) return [];
const size = Math.max(Number(query.size) || 50, 50);
const params = { ...query };
delete params.size;
if (orgNames.length === 1) {
params.organizationName = orgNames[0];
}
const res = await getVehicleList(1, Math.min(size * 5, 200), params);
return filterByOrganizations(extractRecords(res), orgNames).slice(0, size);
};
+137 -7
View File
@@ -1,38 +1,168 @@
/**
* 懒加载 chunk / CSS preload 失败后的整页恢复。
* 常见于:部署后旧 hash 失效、静态服务空闲断连、代理 CONNECTION_RESET。
*
* 失败后必须整页刷新:旧入口里的 hashed 资源地址不会自行更新,
* 仅捕获路由错误而不刷新时,未打开过的页面会一直无法进入。
*/
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 =
/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 时整页落到正确地址 */
let pendingFullPath = '';
let installed = false;
let reloading = false;
export function setPendingRoutePath(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) {
if (!error) return false;
const message = error.message || String(error);
return CHUNK_ERROR_RE.test(message);
const text = collectErrorText(error);
if (!text) return false;
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,避免死循环)
*/
export function reloadForChunkError(targetPath) {
if (reloading) return false;
const now = Date.now();
const last = Number(sessionStorage.getItem(RELOAD_FLAG) || 0);
if (now - last < RELOAD_COOLDOWN_MS) {
return false;
}
reloading = true;
sessionStorage.setItem(RELOAD_FLAG, String(now));
const path = targetPath || pendingFullPath || window.location.pathname + window.location.search + window.location.hash;
window.location.assign(path);
const 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;
}
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(() => {});
}
+39
View File
@@ -0,0 +1,39 @@
/**
* 将高德 Geocoder 结果规范化为地图选址浮层列表数据。
* @param {Array|Object} geocodesOrResult geocodes 数组,或含 geocodes/location 的结果对象
* @param {string} keyword 搜索关键词兜底文案
* @returns {Array<{id: string|number, name: string, address: string, location: any, photo: string}>}
*/
export function normalizeMapSearchResults(geocodesOrResult, keyword = '') {
const fallback = String(keyword || '').trim();
let list = [];
if (Array.isArray(geocodesOrResult)) {
list = geocodesOrResult;
} else if (geocodesOrResult && typeof geocodesOrResult === 'object') {
if (Array.isArray(geocodesOrResult.geocodes)) {
list = geocodesOrResult.geocodes;
} else if (geocodesOrResult.location) {
list = [geocodesOrResult];
}
}
return list.map((item, index) => {
const buildingName = pickNamedField(item?.building);
const neighborhoodName = pickNamedField(item?.neighborhood);
const address = item?.formattedAddress || item?.address || fallback || '-';
return {
id: item?.id || index,
name: buildingName || neighborhoodName || address,
address,
location: item?.location,
photo: item?.photo || item?.image || '',
};
});
}
function pickNamedField(value) {
if (!value) return '';
if (typeof value === 'string') return value.trim();
if (typeof value === 'object' && value.name) return String(value.name).trim();
return '';
}
+94
View File
@@ -0,0 +1,94 @@
import { getDictionary } from '@/api/system/dictbiz';
import { processDelete, processSubmit } from '@/api/system/business-process';
import { ElMessage } from 'element-plus';
export const MK_BIZ = {
'customer-archive': {
dictName: '提交客商审核流',
subjectPrefix: '客商准入审批',
rejected: ['rejected'],
},
'project-apply': {
dictName: '提交项目审核流',
subjectPrefix: '项目审批',
rejected: ['rejected', 'change_rejected', 'withdrawn'],
},
'contract-manage': {
dictName: '提交合同审核流',
subjectPrefix: '合同审批',
rejected: ['rejected', 'change_rejected', 'withdrawn'],
},
'waybill-manage': {
dictName: '提交运单审核流',
subjectPrefix: '运单审批',
rejected: ['rejected', 'returned'],
},
'pre-settlement': {
dictName: '提交预结算审核流',
subjectPrefix: '预结算审批',
rejected: ['returned'],
},
'formal-settlement': {
dictName: '提交正式结算审核流',
subjectPrefix: '正式结算审批',
rejected: ['returned'],
},
'payment-application': {
dictName: '提交付款审核流',
subjectPrefix: '付款审批',
rejected: ['returned'],
},
};
const MK_SWITCH_NAME = '开启MK';
async function loadMkTemplateList() {
const res = await getDictionary({ code: 'mk_template' });
return res?.data?.data || [];
}
/** 业务字典 mk_template:名称「开启MK」且键值为 1 时才请求 MK */
export function isMkEnabled(list = []) {
const matched = list.find(item => String(item.dictValue || '').trim() === MK_SWITCH_NAME);
return String(matched?.dictKey ?? '').trim() === '1';
}
export async function resolveMkTemplateCode(dictName, list) {
const dictList = list || (await loadMkTemplateList());
const matched = dictList.find(item => String(item.dictValue || '').trim() === dictName);
const templateCode = matched?.dictKey;
if (!templateCode) {
ElMessage.warning(`未配置业务字典 mk_template「${dictName}」,无法提交审核流`);
return Promise.reject(new Error(`未配置业务字典 mk_template「${dictName}」`));
}
return String(templateCode);
}
export async function submitMkApprovalFlow({
bizType,
formInstanceId,
subjectName = '',
approvalStatus = '',
}) {
const conf = MK_BIZ[bizType];
if (!conf) {
return Promise.reject(new Error(`不支持的MK业务类型:${bizType}`));
}
const list = await loadMkTemplateList();
if (!isMkEnabled(list)) {
return;
}
if ((conf.rejected || []).includes(approvalStatus)) {
await processDelete({ formInstanceId: String(formInstanceId) });
}
const templateCode = await resolveMkTemplateCode(conf.dictName, list);
const subject = subjectName
? `${conf.subjectPrefix}:${subjectName}`
: `${conf.subjectPrefix}:${formInstanceId}`;
return processSubmit({
templateCode,
formInstanceId: String(formInstanceId),
subject,
bizType,
});
}
+28
View File
@@ -283,3 +283,31 @@ export function validatejson(val) {
// 非对象、非数组、非字符串,或者字符串不是 JSON
return false;
}
/** 登录密码规则提示 */
export const LOGIN_PASSWORD_RULE_MESSAGE =
'密码须大于8位,且同时包含字母、数字和特殊字符(.!@#$%^&*)';
/**
* 校验登录密码强度:大于8位,同时包含字母、数字、特殊字符(.!@#$%^&*)
* @param {string} password
* @returns {boolean}
*/
export function isValidLoginPassword(password) {
return /^(?=.*[A-Za-z])(?=.*\d)(?=.*[.!@#$%^&*]).{9,}$/.test(String(password || ''));
}
/**
* Element Plus / Avue 表单校验器:登录密码强度
*/
export function validateLoginPassword(rule, value, callback) {
if (value === undefined || value === null || String(value).trim() === '') {
callback(new Error('请输入登录密码'));
return;
}
if (!isValidLoginPassword(value)) {
callback(new Error(LOGIN_PASSWORD_RULE_MESSAGE));
return;
}
callback();
}
+58 -4
View File
@@ -94,6 +94,17 @@
/>
</el-select>
</template>
<template #detailAddress-form>
<el-input
v-model="form.detailAddress"
class="detail-address-input"
readonly
maxlength="255"
show-word-limit
placeholder="点击选择地图地址"
@click="openAddressMapPicker"
/>
</template>
<template #longitude-form>
<el-input
v-model="form.longitude"
@@ -121,6 +132,13 @@
</template>
</avue-form>
</el-dialog>
<address-map-picker
v-model="addressMapPickerVisible"
:address="form.detailAddress"
:longitude="form.longitude"
:latitude="form.latitude"
@confirm="handleAddressMapConfirm"
/>
</basic-container>
</template>
@@ -134,6 +152,7 @@ import { openImportDialog } from '@/utils/import-excel';
import { formatUpdateUserName } from '@/utils/audit';
import { getToken } from '@/utils/auth';
import { getCoordinateValidationMessage, normalizeCoordinateInput } from '@/utils/coordinate';
import AddressMapPicker from '@/components/address-map-picker/main.vue';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
@@ -181,6 +200,9 @@ const addExcelRequiredHeaderMarks = async blob => {
};
export default {
components: {
AddressMapPicker,
},
data() {
const validateIataCode = (rule, value, callback) => {
if (!/^[A-Z]{3}$/.test(String(value || '').toUpperCase())) {
@@ -220,6 +242,7 @@ export default {
loading: true,
data: [],
excelBox: false,
addressMapPickerVisible: false,
excelForm: {},
provinceOptions: [],
cityOptions: [],
@@ -368,15 +391,14 @@ export default {
{
label: '详细地址',
prop: 'detailAddress',
type: 'textarea',
minRows: 2,
formslot: true,
span: 24,
minWidth: 220,
overHidden: false,
maxlength: 255,
showWordLimit: true,
rules: [
{ required: true, message: '请输入详细地址', trigger: 'blur' },
{ required: true, message: '请选择详细地址', trigger: 'change' },
{ max: 255, message: '详细地址不能超过255字', trigger: 'blur' },
],
},
@@ -504,7 +526,7 @@ export default {
propsHttp: {
res: 'data',
},
tip: '请上传 .xls,.xlsx 标准格式文件',
tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
accept: '.xls,.xlsx',
action: '/blade-system/airport-master/import-airport-master',
},
@@ -669,6 +691,29 @@ export default {
handleCoordinateInput(prop, value) {
this.form[prop] = normalizeCoordinateInput(value);
},
openAddressMapPicker() {
this.addressMapPickerVisible = true;
},
handleAddressMapConfirm(payload) {
const selection = typeof payload === 'string' ? { address: payload } : payload || {};
if (selection.address) {
this.form.detailAddress = selection.address;
}
if (
selection.longitude !== undefined &&
selection.longitude !== null &&
selection.longitude !== ''
) {
this.form.longitude = Number(selection.longitude).toFixed(6);
}
if (
selection.latitude !== undefined &&
selection.latitude !== null &&
selection.latitude !== ''
) {
this.form.latitude = Number(selection.latitude).toFixed(6);
}
},
normalizeRow(row) {
row.code = row.iataCode ? `JC-${row.iataCode}` : row.code;
row.regionCode = String(row.regionCode || '').trim();
@@ -917,4 +962,13 @@ export default {
white-space: nowrap;
}
}
.detail-address-input {
cursor: pointer;
:deep(.el-input__wrapper),
:deep(.el-input__inner) {
cursor: pointer;
}
}
</style>
+1 -1
View File
@@ -274,7 +274,7 @@ export default {
res: 'data',
},
headers: getUploadHeaders(),
tip: '请上传 .xls,.xlsx 标准格式文件',
tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
action: '/blade-system/cargo-type/import-cargo-type',
},
{
+3 -7
View File
@@ -233,8 +233,8 @@
</el-button>
</div>
<div class="map-picker-content">
<map-search-results :results="mapSearchResults" @select="selectMapSearchResult" />
<div ref="amap" class="common-address-page__map"></div>
<map-search-results :results="mapSearchResults" @select="selectMapSearchResult" />
</div>
<div class="common-address-page__map-info">
<span>{{ mapStatus }}</span>
@@ -270,6 +270,7 @@ import { createOption } from '@/option/base/common-address';
import { mapGetters } from 'vuex';
import { downloadXls } from '@/utils/util';
import { getToken } from '@/utils/auth';
import { normalizeMapSearchResults } from '@/utils/map-search';
import { isMobile } from '@/utils/validate';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
@@ -1117,12 +1118,7 @@ export default {
this.ensureAmapGeocoder()
.then(() => this.runAmapGeocode('location', keyword))
.then(result => {
this.mapSearchResults = (result.geocodes || []).map((item, index) => ({
id: item.id || index,
name: item.formattedAddress || keyword,
address: item.formattedAddress || keyword,
location: item.location,
}));
this.mapSearchResults = normalizeMapSearchResults(result, keyword);
const point = this.resolveMapPoint(result);
if (!point) {
this.mapStatus = '未找到匹配地址';
+1 -1
View File
@@ -326,7 +326,7 @@ export default {
propsHttp: {
res: 'data',
},
tip: '请上传 .xls,.xlsx 标准格式文件',
tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
action: '/blade-system/currency/import-currency',
},
{
+1
View File
@@ -119,6 +119,7 @@ export default {
return this.isAdmin || this.permission?.[code] === true;
},
normalizeRow(row) {
row.unitCode = String(row.unitCode || '').trim();
row.unitName = String(row.unitName || '').trim();
row.dimension = String(row.dimension || '').trim();
row.remark = String(row.remark || '').trim();
+43 -6
View File
@@ -194,10 +194,11 @@
<el-input
v-model="form.detailAddress"
class="detail-address-input"
clearable
readonly
maxlength="255"
show-word-limit
placeholder="请输入"
placeholder="点击选择地图地址"
@click="openAddressMapPicker"
/>
</template>
<template #remark-form>
@@ -244,6 +245,13 @@
</template>
</avue-form>
</el-dialog>
<address-map-picker
v-model="addressMapPickerVisible"
:address="form.detailAddress"
:longitude="form.longitude"
:latitude="form.latitude"
@confirm="handleAddressMapConfirm"
/>
</basic-container>
</template>
@@ -264,12 +272,16 @@ import { openImportDialog } from '@/utils/import-excel';
import { formatUpdateUserName } from '@/utils/audit';
import { getToken } from '@/utils/auth';
import { getCoordinateValidationMessage, normalizeCoordinateInput } from '@/utils/coordinate';
import AddressMapPicker from '@/components/address-map-picker/main.vue';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
const DEFAULT_COUNTRY_CODE = '+86';
const newLocal = '请选择类型';
export default {
components: {
AddressMapPicker,
},
data() {
const validateCode = (rule, value, callback) => {
const code = String(value || '').toUpperCase();
@@ -315,6 +327,7 @@ export default {
loading: true,
data: [],
excelBox: false,
addressMapPickerVisible: false,
excelForm: {},
portOptions: [],
countryOptions: [],
@@ -572,11 +585,11 @@ export default {
minWidth: 220,
overHidden: false,
order: 85,
placeholder: '请输入',
placeholder: '点击选择地图地址',
maxlength: 255,
showWordLimit: true,
rules: [
{ required: true, message: '请输入详细地址', trigger: 'blur' },
{ required: true, message: '请选择详细地址', trigger: 'change' },
{ max: 255, message: '详细地址不能超过255字', trigger: 'blur' },
],
},
@@ -673,7 +686,7 @@ export default {
propsHttp: {
res: 'data',
},
tip: '请上传 .xls,.xlsx 标准格式文件',
tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
accept: '.xls,.xlsx',
action: '/blade-system/port-terminal/import-port-terminal',
},
@@ -1040,6 +1053,21 @@ export default {
handleCoordinateInput(prop, value) {
this.form[prop] = normalizeCoordinateInput(value);
},
openAddressMapPicker() {
this.addressMapPickerVisible = true;
},
handleAddressMapConfirm(payload) {
const selection = typeof payload === 'string' ? { address: payload } : payload || {};
if (selection.address) {
this.form.detailAddress = selection.address;
}
if (selection.longitude !== undefined && selection.longitude !== null && selection.longitude !== '') {
this.form.longitude = Number(selection.longitude).toFixed(6);
}
if (selection.latitude !== undefined && selection.latitude !== null && selection.latitude !== '') {
this.form.latitude = Number(selection.latitude).toFixed(6);
}
},
resolveCountryCode(country) {
if (!country) {
return Promise.resolve('');
@@ -1107,7 +1135,7 @@ export default {
return false;
}
if (isBlank(row.detailAddress)) {
this.$message.warning('请输入详细地址');
this.$message.warning('请选择详细地址');
return false;
}
if (isBlank(row.longitude)) {
@@ -1399,6 +1427,15 @@ export default {
line-height: 20px;
padding: 4px 0;
}
.detail-address-input {
cursor: pointer;
:deep(.el-input__wrapper),
:deep(.el-input__inner) {
cursor: pointer;
}
}
</style>
<style lang="scss">
+57 -5
View File
@@ -94,6 +94,17 @@
/>
</el-select>
</template>
<template #detailAddress-form>
<el-input
v-model="form.detailAddress"
class="detail-address-input"
readonly
maxlength="255"
show-word-limit
placeholder="点击选择地图地址"
@click="openAddressMapPicker"
/>
</template>
<template #longitude-form>
<el-input
v-model="form.longitude"
@@ -121,6 +132,13 @@
</template>
</avue-form>
</el-dialog>
<address-map-picker
v-model="addressMapPickerVisible"
:address="form.detailAddress"
:longitude="form.longitude"
:latitude="form.latitude"
@confirm="handleAddressMapConfirm"
/>
</basic-container>
</template>
@@ -134,12 +152,16 @@ import { openImportDialog } from '@/utils/import-excel';
import { formatUpdateUserName } from '@/utils/audit';
import { getToken } from '@/utils/auth';
import { getCoordinateValidationMessage, normalizeCoordinateInput } from '@/utils/coordinate';
import AddressMapPicker from '@/components/address-map-picker/main.vue';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
const DEFAULT_COUNTRY_CODE = '+86';
export default {
components: {
AddressMapPicker,
},
data() {
const validateTmisCode = (rule, value, callback) => {
if (!/^\d{5}$/.test(value || '')) {
@@ -185,6 +207,7 @@ export default {
loading: true,
data: [],
excelBox: false,
addressMapPickerVisible: false,
excelForm: {},
provinceOptions: [],
cityOptions: [],
@@ -340,15 +363,14 @@ export default {
{
label: '详细地址',
prop: 'detailAddress',
type: 'textarea',
minRows: 2,
formslot: true,
span: 24,
minWidth: 220,
overHidden: false,
maxlength: 255,
showWordLimit: true,
rules: [
{ required: true, message: '请输入详细地址', trigger: 'blur' },
{ required: true, message: '请选择详细地址', trigger: 'change' },
{ max: 255, message: '详细地址不能超过255字', trigger: 'blur' },
],
},
@@ -475,7 +497,7 @@ export default {
propsHttp: {
res: 'data',
},
tip: '请上传 .xls,.xlsx 标准格式文件',
tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
accept: '.xls,.xlsx',
action: '/blade-system/railway-station/import-railway-station',
},
@@ -652,6 +674,29 @@ export default {
handleCoordinateInput(prop, value) {
this.form[prop] = normalizeCoordinateInput(value);
},
openAddressMapPicker() {
this.addressMapPickerVisible = true;
},
handleAddressMapConfirm(payload) {
const selection = typeof payload === 'string' ? { address: payload } : payload || {};
if (selection.address) {
this.form.detailAddress = selection.address;
}
if (
selection.longitude !== undefined &&
selection.longitude !== null &&
selection.longitude !== ''
) {
this.form.longitude = Number(selection.longitude).toFixed(6);
}
if (
selection.latitude !== undefined &&
selection.latitude !== null &&
selection.latitude !== ''
) {
this.form.latitude = Number(selection.latitude).toFixed(6);
}
},
normalizeRow(row) {
row.code = row.tmisCode ? `TL${row.tmisCode}` : row.code;
row.regionCode = String(row.regionCode || '').trim();
@@ -910,9 +955,16 @@ export default {
:deep(.el-table td .cell) {
white-space: nowrap;
}
}
.detail-address-input {
cursor: pointer;
:deep(.el-input__wrapper),
:deep(.el-input__inner) {
cursor: pointer;
}
}
</style>
<style lang="scss">
+1 -1
View File
@@ -309,7 +309,7 @@ export default {
propsHttp: {
res: 'data',
},
tip: '请上传 .xls,.xlsx 标准格式文件',
tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
action: '/blade-system/region/import-region',
},
{
+3 -7
View File
@@ -289,8 +289,8 @@
</el-button>
</div>
<div class="map-picker-content">
<map-search-results :results="routeMapSearchResults" @select="selectRouteMapSearchResult" />
<div ref="routeAmap" class="common-route-page__map"></div>
<map-search-results :results="routeMapSearchResults" @select="selectRouteMapSearchResult" />
</div>
<div class="common-route-page__map-info">
<span>{{ routeMapStatus }}</span>
@@ -323,6 +323,7 @@ import { addressTypeOptions } from '@/option/base/common-address';
import { config, excelOption, option } from '@/option/business/common-route';
import { getToken } from '@/utils/auth';
import { openImportDialog } from '@/utils/import-excel';
import { normalizeMapSearchResults } from '@/utils/map-search';
import { downloadXls } from '@/utils/util';
import { isMobile } from '@/utils/validate';
import { List, Search } from '@element-plus/icons-vue';
@@ -616,12 +617,7 @@ export default {
})
.then(() => this.runAmapGeocode('location', keyword))
.then(result => {
this.routeMapSearchResults = (result.geocodes || []).map((item, index) => ({
id: item.id || index,
name: item.formattedAddress || keyword,
address: item.formattedAddress || keyword,
location: item.location,
}));
this.routeMapSearchResults = normalizeMapSearchResults(result, keyword);
const point = this.resolveMapPoint(result);
if (!point) {
this.routeMapStatus = '未找到匹配地址';
@@ -157,12 +157,19 @@
<el-table-column label="计费单位" width="150"
><template #default="{ row }"
><span v-if="readonly">{{ displayValue(row.billingUnit) }}</span
><el-select v-else v-model="row.billingUnit" clearable filterable :loading="unitLoading"
><el-select
v-else
v-model="row.billingUnit"
clearable
filterable
:disabled="!canSelectBillingUnit(row)"
:loading="unitLoading"
:placeholder="billingUnitPlaceholder(row)"
><el-option
v-for="item in unitOptions"
:key="item.id || item.dictKey || item.dictValue"
:label="item.dictValue"
:value="item.dictValue" /></el-select></template
v-for="item in unitOptionsFor(row)"
:key="item.id || item.value"
:label="item.label"
:value="item.value" /></el-select></template
></el-table-column>
<el-table-column label="单价(元)" width="180"
><template #default="{ row }"
@@ -367,12 +374,26 @@
<script>
import { getList as getCargoTypeList } from '@/api/base/cargo-type';
import { getList as getFeeItemList } from '@/api/base/fee-item';
import { getList as getMeasurementUnitList } from '@/api/base/measurement-unit';
import { getLazyTree as getRegionLazyTree } from '@/api/base/region';
import { InfoFilled } from '@element-plus/icons-vue';
import { getDictionary } from '@/api/system/dictbiz';
import SectionCard from '@/components/section-card/main.vue';
const clone = value => JSON.parse(JSON.stringify(value));
/** 计费要素与计量单位维度的对应关系(这些要素可选计费单位) */
const BILLING_ELEMENT_DIMENSION_MAP = {
按重量: '重量',
按体积: '体积',
按数量: '数量',
};
const BILLING_UNIT_SELECTABLE_ELEMENTS = Object.keys(BILLING_ELEMENT_DIMENSION_MAP);
/** 固定计费单位(不可编辑) */
const FIXED_BILLING_UNIT_MAP = {
按里程: '公里',
'按吨·公里': '吨公里',
'固定金额(整单一口价)': '单',
};
const defaultRule = () => ({
feeType: '',
feeItem: '',
@@ -417,11 +438,11 @@ export default {
feeItems: {},
feeItemLoadingMap: {},
unitOptions: [],
measurementUnits: [],
unitLoading: false,
billingElements: [
'按重量',
'按体积',
'按车辆',
'按里程',
'按吨·公里',
'固定金额(整单一口价)',
@@ -430,7 +451,6 @@ export default {
typeMap: {
按重量: ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'],
按体积: ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'],
按车辆: ['固定单价'],
按里程: ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'],
'按吨·公里': ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'],
'固定金额(整单一口价)': ['固定一口价'],
@@ -545,6 +565,7 @@ export default {
next.limitRanges = next.limitRanges.map(item => ({ ...item, minimumBillingWeight: '' }));
this.syncLegacyLimit(next);
next.matchCondition = { ...defaultRule().matchCondition, ...(rule.matchCondition || {}) };
this.syncBillingUnit(next);
return next;
},
normalizeRanges(row) {
@@ -614,14 +635,75 @@ export default {
.finally(() => {
this.feeCategoryLoading = false;
});
this.loadUnitOptions();
},
loadUnitOptions() {
this.unitLoading = true;
getDictionary({ code: 'unit_fee' })
.then(res => {
Promise.all([
getDictionary({ code: 'unit_fee' }).then(res => {
this.unitOptions = res.data?.data || [];
})
.finally(() => {
this.unitLoading = false;
});
}),
getMeasurementUnitList(1, 9999, { status: 1 }).then(res => {
const data = res?.data?.data || res?.data || {};
const records = Array.isArray(data) ? data : data.records || [];
this.measurementUnits = records.filter(
item => item.status === undefined || item.status === null || Number(item.status) === 1
);
}),
]).finally(() => {
this.unitLoading = false;
});
},
measurementDimension(billingElement) {
return BILLING_ELEMENT_DIMENSION_MAP[billingElement] || '';
},
fixedBillingUnit(billingElement) {
return FIXED_BILLING_UNIT_MAP[String(billingElement || '').trim()] || '';
},
canSelectBillingUnit(row) {
return BILLING_UNIT_SELECTABLE_ELEMENTS.includes(String(row?.billingElement || '').trim());
},
billingUnitPlaceholder(row) {
if (!row?.billingElement) return '请先选择计费要素';
if (this.fixedBillingUnit(row.billingElement)) return this.fixedBillingUnit(row.billingElement);
if (!this.canSelectBillingUnit(row)) return '当前计费要素无需选择';
return '请选择';
},
unitOptionsFor(row) {
const fixedUnit = this.fixedBillingUnit(row?.billingElement);
if (fixedUnit) {
return [{ id: fixedUnit, label: fixedUnit, value: fixedUnit }];
}
if (!this.canSelectBillingUnit(row)) {
return [];
}
const dimension = this.measurementDimension(row?.billingElement);
if (dimension) {
return this.measurementUnits
.filter(item => String(item.dimension || '').trim() === dimension)
.map(item => ({
id: item.id,
label: item.unitName,
value: item.unitName,
}))
.filter(item => item.value);
}
return [];
},
syncBillingUnit(row) {
const fixedUnit = this.fixedBillingUnit(row?.billingElement);
if (fixedUnit) {
row.billingUnit = fixedUnit;
return;
}
if (!this.canSelectBillingUnit(row)) {
row.billingUnit = '';
return;
}
const options = this.unitOptionsFor(row);
if (!options.some(item => String(item.value) === String(row.billingUnit || ''))) {
row.billingUnit = '';
}
},
feeTypeKey(row) {
const option = this.feeCategories.find(
@@ -699,7 +781,14 @@ export default {
return this.typeMap[row.billingElement] || [];
},
handleElementChange(row) {
if (!this.billingTypes(row).includes(row.billingType)) row.billingType = '';
const billingTypes = this.billingTypes(row);
if (!billingTypes.includes(row.billingType)) {
row.billingType =
row.billingElement === '固定金额(整单一口价)' && billingTypes.includes('固定一口价')
? '固定一口价'
: '';
}
this.syncBillingUnit(row);
if (!this.canEditMinimum(row)) {
row.minimumBillingWeight = '';
row.limitRanges = (row.limitRanges || []).map(item => ({
@@ -831,7 +920,6 @@ export default {
['taxRate', '税率'],
['billingElement', '计费要素'],
['billingType', '计费类型'],
['billingUnit', '计费单位'],
];
for (const [i, row] of this.draft.rules.entries()) {
const empty = required.find(
@@ -841,6 +929,15 @@ export default {
this.$message.warning(`第${i + 1}行${empty[1]}不能为空`);
return false;
}
if (
this.canSelectBillingUnit(row) &&
(row.billingUnit === undefined ||
row.billingUnit === null ||
String(row.billingUnit).trim() === '')
) {
this.$message.warning(`第${i + 1}行计费单位不能为空`);
return false;
}
const feeItem = String(row.feeItem).trim();
if (feeItemSet.has(feeItem)) {
this.$message.warning(`费用项“${feeItem}”不能重复`);
@@ -1899,11 +1899,11 @@
label-width="auto"
class="business-crud-page__module-form business-crud-page__module-form--three"
>
<el-form-item label="账单起始日期" required :error="settlementRuleErrors.billStartDate">
<el-form-item label="账单起始日" required :error="settlementRuleErrors.billStartDate">
<el-date-picker
v-model="settlementRuleForm.billStartDate"
type="date"
placeholder="请选择账单起始日期"
placeholder="请选择账单起始日"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
:disabled="dialogReadonly"
@@ -2478,7 +2478,7 @@
{{ formatTransportPlanDetailTransportType(waybillTransportMode(detailRow)) }}
</span>
<el-link
v-if="detailRow.id"
v-if="detailRow.id && canChangeWaybillRoute(detailRow)"
class="business-crud-page__waybill-route-change-link"
type="primary"
@click="openWaybillRouteChangeDialog"
@@ -2947,35 +2947,6 @@
</el-table-column>
</el-table>
</section-card>
<section-card title="路线编辑">
<template #extra>
<span class="business-crud-page__route-change-hint">拖拽调整顺序</span>
</template>
<div
v-if="waybillRouteChangeNodes.length"
class="business-crud-page__route-change-list"
>
<div
v-for="(node, index) in waybillRouteChangeNodes"
:key="node.key || index"
class="business-crud-page__route-change-item"
draggable="true"
@dragstart="handleWaybillRouteChangeDragStart(index)"
@dragover.prevent
@drop="handleWaybillRouteChangeDrop(index)"
>
<span class="business-crud-page__route-change-type">
{{ waybillRouteChangeTypeText(index) }}
</span>
<span>{{ node.address }}</span>
<span class="business-crud-page__route-change-tags">
<el-tag v-for="tag in node.tags || []" :key="tag" size="small">{{ tag }}</el-tag>
</span>
<el-icon><Rank /></el-icon>
</div>
</div>
<el-empty v-else description="暂无路线" :image-size="60" />
</section-card>
<el-form label-width="auto">
<el-form-item label="变更备注" style="margin-top: 8px">
<el-input
@@ -3374,7 +3345,7 @@
{{ dispatchDialogStatusText }}
</el-tag>
<el-tag type="primary" effect="light">
{{ formatDispatchTransportType(dispatchRow.transportType) || '公路整车' }}
{{ formatDispatchTransportType(dispatchRow.transportType) || '公路运输' }}
</el-tag>
</div>
</div>
@@ -4036,7 +4007,7 @@
</el-input>
<div class="business-crud-page__dispatch-quantity-hint">
剩余数量:{{
formatDispatchQuantity(dispatchItemRemainingQuantity(dispatchItemForm))
formatDispatchQuantity(dispatchItemHintRemainingQuantity(dispatchItemForm))
}}
{{ dispatchItemForm.quantityUnit || '吨' }}
</div>
@@ -4093,7 +4064,11 @@
</el-input>
</el-form-item>
<el-form-item label="其他费用合计">
<el-input v-model="dispatchItemForm.otherFeeTotal" placeholder="请输入">
<el-input
v-model="dispatchItemForm.otherFeeTotal"
placeholder="请输入"
@input="value => handleDispatchNumberInput('otherFeeTotal', value)"
>
<template #suffix>{{ dispatchItemFreightCurrencyLabel }}</template>
</el-input>
</el-form-item>
@@ -5025,8 +5000,8 @@
</el-button>
</div>
<div class="map-picker-content">
<map-search-results :results="transportMapSearchResults" @select="selectTransportMapSearchResult" />
<div ref="transportAmap" class="business-crud-page__map"></div>
<map-search-results :results="transportMapSearchResults" @select="selectTransportMapSearchResult" />
</div>
<div class="business-crud-page__map-info">
<span>{{ transportMapStatus }}</span>
@@ -5300,7 +5275,7 @@ import {
getVoucherImages as getProcessConfigVoucherImages,
} from '@/api/business/process-config';
import { getList as getCarrierCustomerList } from '@/api/vehicle/customer-archive';
import { getList as getDriverList } from '@/api/transportCapacity/driver';
import { fetchDriversByCarrierOrganizations } from '@/utils/carrier-org-resource';
import { getDictionary } from '@/api/system/dictbiz';
import { getDictionary as getSystemDictionary } from '@/api/system/dict';
import { addressTypeOptions } from '@/option/base/common-address';
@@ -5308,10 +5283,11 @@ import { packageOptions } from '@/option/business/common';
import { formatUpdateUserName } from '@/utils/audit';
import { getToken } from '@/utils/auth';
import { openImportDialog } from '@/utils/import-excel';
import { normalizeMapSearchResults } from '@/utils/map-search';
import { applyTableMenuWidth } from '@/utils/table-menu';
import { downloadFileByUrl, downloadXls } from '@/utils/util';
import { isMobile } from '@/utils/validate';
import { Location, OfficeBuilding, Rank, Search } from '@element-plus/icons-vue';
import { Location, OfficeBuilding, Search } from '@element-plus/icons-vue';
import { ElImageViewer } from 'element-plus';
import { OpenFileViewer } from '@open-file-viewer/vue';
import {
@@ -5574,7 +5550,6 @@ export default {
components: {
BillingPlanEditor,
PageAvueForm,
Rank,
ElImageViewer,
OpenFileViewer,
},
@@ -5637,7 +5612,6 @@ export default {
waybillRouteChangeNodes: [],
waybillRouteChangeRemark: '',
waybillRouteChangeRecords: [],
waybillRouteChangeDragIndex: -1,
waybillRouteChangeSaving: false,
mileageDialog: {
visible: false,
@@ -6371,19 +6345,21 @@ export default {
if (this.dispatchItemForm.taskEntryMode !== 'full') {
const quantity = Number(this.dispatchItemForm.quantity || 0);
const unitPrice = Number(this.dispatchItemForm.unitPrice || 0);
const otherFeeTotal = Number(this.dispatchItemForm.otherFeeTotal || 0);
const otherFeeRaw = this.normalizeDispatchFeeValue(this.dispatchItemForm.otherFeeTotal);
const otherFeeTotal = Number(otherFeeRaw || 0);
const hasFreight = this.dispatchItemForm.unitPrice !== '' && quantity > 0;
const hasOtherFee = this.dispatchItemForm.otherFeeTotal !== '';
const hasOtherFee = otherFeeRaw !== '';
if (!hasFreight && !hasOtherFee) return '';
const total = (hasFreight ? quantity * unitPrice : 0) + (hasOtherFee ? otherFeeTotal : 0);
return Number.isInteger(total) ? String(total) : String(Number(total.toFixed(2)));
}
const otherFeeTotal = Number(this.dispatchItemForm.otherFeeTotal || 0);
const otherFeeRaw = this.normalizeDispatchFeeValue(this.dispatchItemForm.otherFeeTotal);
const otherFeeTotal = Number(otherFeeRaw || 0);
const freightTotal = this.dispatchItemCargoRows.reduce(
(total, cargo) => total + Number(this.dispatchCargoFreightAmount(cargo) || 0),
0
);
const hasOtherFee = this.dispatchItemForm.otherFeeTotal !== '';
const hasOtherFee = otherFeeRaw !== '';
if (!freightTotal && !hasOtherFee) return '';
const total = freightTotal + (hasOtherFee ? otherFeeTotal : 0);
return Number.isInteger(total) ? String(total) : String(Number(total.toFixed(2)));
@@ -7438,7 +7414,7 @@ export default {
: [];
},
openWaybillRouteChangeDialog() {
if (!this.detailRow.id) return;
if (!this.detailRow.id || !this.canChangeWaybillRoute(this.detailRow)) return;
this.restoreWaybillRouteChangeRecords();
this.waybillRouteChangeTab = 'change';
this.waybillRouteChangeRemark = '';
@@ -7455,22 +7431,11 @@ export default {
this.waybillRouteChangeNodes = this.buildWaybillRouteNodes(this.waybillRouteChangeRows);
this.waybillRouteChangeBox = true;
},
waybillRouteChangeTypeText(index) {
if (index === 0) return '起';
if (index === this.waybillRouteChangeNodes.length - 1) return '终';
return '经';
},
handleWaybillRouteChangeDragStart(index) {
this.waybillRouteChangeDragIndex = index;
},
handleWaybillRouteChangeDrop(index) {
if (this.waybillRouteChangeDragIndex < 0 || this.waybillRouteChangeDragIndex === index)
return;
const nodes = [...this.waybillRouteChangeNodes];
const [node] = nodes.splice(this.waybillRouteChangeDragIndex, 1);
nodes.splice(index, 0, node);
this.waybillRouteChangeNodes = nodes;
this.waybillRouteChangeDragIndex = -1;
canChangeWaybillRoute(row = {}) {
const status = String(this.statusValue(row) || row.businessStatus || row.status || '');
if (status === 'completed') return false;
const statusName = String(row.businessStatusName || row.statusName || '');
return !statusName.includes('已完成');
},
updateWaybillRouteChangeNodes() {
this.waybillRouteChangeNodes = this.buildWaybillRouteNodes(this.waybillRouteChangeRows);
@@ -7519,9 +7484,8 @@ export default {
row.departureAddress !== row.originalDepartureAddress ||
row.arrivalAddress !== row.originalArrivalAddress;
const routeJson = JSON.stringify(this.waybillRouteChangeNodes);
const originalRouteJson = this.detailRow.routeJson || '';
if (!changed && routeJson === originalRouteJson && !this.waybillRouteChangeRemark) {
this.$message.warning('请修改地址、调整路线或填写变更备注');
if (!changed && !this.waybillRouteChangeRemark) {
this.$message.warning('请修改地址或填写变更备注');
return;
}
if (typeof this.api.changeRoute !== 'function') {
@@ -7529,11 +7493,9 @@ export default {
return;
}
const content = changed
? `${row.waybillNo || '运单'}:发货地 ${row.originalDepartureAddress || '-'} → ${
row.departureAddress || '-'
};到货地 ${row.originalArrivalAddress || '-'} → ${row.arrivalAddress || '-'}`
: '调整运输路线顺序';
const content = `${row.waybillNo || '运单'}:发货地 ${row.originalDepartureAddress || '-'} → ${
row.departureAddress || '-'
};到货地 ${row.originalArrivalAddress || '-'} → ${row.arrivalAddress || '-'}`;
const records = [
{
changeTime: this.$dayjs().format('YYYY-MM-DD HH:mm:ss'),
@@ -7784,8 +7746,8 @@ export default {
const rule = this.normalizeSettlementRule(source);
this.settlementRuleErrors = {};
if (this.isBillingFieldEmpty(rule.billStartDate)) {
this.settlementRuleErrors = { billStartDate: '请选择账单起始日期' };
this.$message.warning(`${label}${label ? ':' : ''}请选择账单起始日期`);
this.settlementRuleErrors = { billStartDate: '请选择账单起始日' };
this.$message.warning(`${label}${label ? ':' : ''}请选择账单起始日`);
return false;
}
if (this.isBillingFieldEmpty(rule.settlementType)) {
@@ -8964,6 +8926,7 @@ export default {
this.form.carrierContractId = '';
}
this.form.carrierType = nextValue;
this.clearTaskDriverVehicleFields();
if (this.isWaybillDetailLayout) {
this.taskCarrierRequestId += 1;
this.taskCarrierOptions = [];
@@ -9081,25 +9044,58 @@ export default {
},
handleTaskCarrierChange(value) {
const carrier = this.taskCarrierOptions.find(item =>
[item.value, item.customerName, item.carrierName, item.fullName, item.name].some(name =>
String(name || '') === String(value || '')
)
[
item.value,
item.customerName,
item.carrierName,
item.fullName,
item.name,
item.carrierContractId,
].some(name => String(name || '') === String(value || ''))
);
if (this.isWaybillDetailLayout && this.form.carrierType === '承运商') {
this.form.carrierContractId = carrier?.carrierContractId || '';
this.form.carrierId = carrier?.carrierId || '';
this.form.carrierName = carrier?.carrierName || value || '';
return;
} else {
this.form.carrierId = carrier?.id || carrier?.carrierId || '';
this.form.carrierName = value || '';
}
this.form.carrierId = carrier?.id || '';
this.form.carrierName = value || '';
this.clearTaskDriverVehicleFields();
},
clearTaskDriverVehicleFields() {
this.form.driverId = '';
this.form.driverName = '';
this.form.driverPhone = '';
this.form.vehicleNo = '';
this.form.trailerVehicleNo = '';
this.form.escortName = '';
this.form.escortPhone = '';
this.taskDriverOptions = [];
},
getActiveCarrierFilter() {
if (this.dispatchItemBox) {
return {
carrierId: this.dispatchItemForm.carrierId || '',
carrierName: this.dispatchItemForm.carrierName || '',
};
}
return {
carrierId: this.form.carrierId || '',
carrierName: this.form.carrierName || '',
};
},
loadTaskDriverOptions() {
if (!this.taskInfoFormEnabled || this.taskDriverLoading) return Promise.resolve([]);
const carrier = this.getActiveCarrierFilter();
if (!carrier.carrierId && !carrier.carrierName) {
this.taskDriverOptions = [];
return Promise.resolve([]);
}
this.taskDriverLoading = true;
return getDriverList(1, 9999, {})
.then(res => {
this.taskDriverOptions = extractRecords(res);
return fetchDriversByCarrierOrganizations({ size: 9999, posts: '司机' }, carrier)
.then(records => {
this.taskDriverOptions = records;
return this.taskDriverOptions;
})
.finally(() => {
@@ -9108,10 +9104,17 @@ export default {
},
fetchTaskDriverSuggestions(queryString, callback) {
const keyword = String(queryString || '').trim();
const carrier = this.getActiveCarrierFilter();
if (!carrier.carrierId && !carrier.carrierName) {
callback([]);
return;
}
this.taskDriverLoading = true;
getDriverList(1, 20, keyword ? { driverName: keyword } : {})
.then(res => {
const records = extractRecords(res);
fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '司机' },
carrier
)
.then(records => {
this.taskDriverOptions = records;
callback(
records.map(item => ({
@@ -10284,12 +10287,7 @@ export default {
this.ensureTransportAmapGeocoder()
.then(() => this.runAmapGeocode('location', keyword))
.then(result => {
this.transportMapSearchResults = (result.geocodes || []).map((item, index) => ({
id: item.id || index,
name: item.formattedAddress || keyword,
address: item.formattedAddress || keyword,
location: item.location,
}));
this.transportMapSearchResults = normalizeMapSearchResults(result, keyword);
const point = this.resolveMapPoint(result);
if (!point) {
this.transportMapStatus = '未找到匹配地址';
@@ -12805,6 +12803,9 @@ export default {
...baseRow,
...(index >= 0 ? row : {}),
};
this.dispatchItemForm.otherFeeTotal = this.normalizeDispatchFeeValue(
this.dispatchItemForm.otherFeeTotal
);
this.dispatchItemForm.carrierType = this.dispatchItemForm.carrierType || '承运商';
const goodsRows = this.parseJsonArray(this.dispatchItemForm.goodsJson);
this.dispatchItemCargoRows = (goodsRows.length ? goodsRows : [this.dispatchItemForm]).map(
@@ -12861,6 +12862,7 @@ export default {
}
}
this.dispatchItemForm.carrierType = nextValue;
this.clearDispatchDriverVehicleFields();
this.loadDispatchCarrierOptions(this.dispatchRow);
},
isDispatchCarrierRequired(carrierType) {
@@ -12990,20 +12992,39 @@ export default {
});
if (this.dispatchIsCarrierMode) {
this.dispatchItemForm.carrierContractId = carrier?.carrierContractId || '';
this.dispatchItemForm.carrierId = '';
this.dispatchItemForm.carrierId = carrier?.carrierId || '';
this.dispatchItemForm.carrierName = carrier?.carrierName || '';
return;
} else {
this.dispatchItemForm.carrierContractId = '';
this.dispatchItemForm.carrierId = carrier?.id || carrier?.carrierId || '';
this.dispatchItemForm.carrierName = carrier?.carrierName || value || '';
}
this.dispatchItemForm.carrierContractId = '';
this.dispatchItemForm.carrierId = carrier?.id || '';
this.dispatchItemForm.carrierName = carrier?.carrierName || value || '';
this.clearDispatchDriverVehicleFields();
},
clearDispatchDriverVehicleFields() {
this.dispatchItemForm.driverId = '';
this.dispatchItemForm.driverName = '';
this.dispatchItemForm.driverPhone = '';
this.dispatchItemForm.vehicleNo = '';
this.dispatchItemForm.trailerVehicleNo = '';
this.dispatchItemForm.escortName = '';
this.dispatchItemForm.escortPhone = '';
this.taskDriverOptions = [];
},
loadDispatchDriverOptions() {
if (this.taskDriverLoading) return Promise.resolve([]);
const carrier = {
carrierId: this.dispatchItemForm.carrierId || '',
carrierName: this.dispatchItemForm.carrierName || '',
};
if (!carrier.carrierId && !carrier.carrierName) {
this.taskDriverOptions = [];
return Promise.resolve([]);
}
this.taskDriverLoading = true;
return getDriverList(1, 9999, {})
.then(res => {
this.taskDriverOptions = extractRecords(res);
return fetchDriversByCarrierOrganizations({ size: 9999, posts: '司机' }, carrier)
.then(records => {
this.taskDriverOptions = records;
return this.taskDriverOptions;
})
.finally(() => {
@@ -13080,6 +13101,11 @@ export default {
this.dispatchItemForm[prop] =
parts.length > 1 ? `${parts[0]}.${parts.slice(1).join('').slice(0, 2)}` : parts[0];
},
normalizeDispatchFeeValue(value) {
if (value === undefined || value === null || value === '') return '';
if (Number(value) === -1) return '';
return value;
},
addDispatchCargoRow(index = -1) {
const nextRow = this.normalizeTransportCargoRow({ priceUnit: '元/吨' });
if (index > -1) this.dispatchItemCargoRows.splice(index + 1, 0, nextRow);
@@ -13163,6 +13189,12 @@ export default {
}, 0)
);
},
/** 精简录入提示:可调度余量扣减当前本次数量后的剩余 */
dispatchItemHintRemainingQuantity(row = {}) {
const available = this.dispatchItemRemainingQuantity(row);
const current = this.parseDispatchQuantity(row.quantity);
return Math.max(available - current, 0);
},
pruneDispatchPendingRows(rows = []) {
const planQuantities = new Map();
this.dispatchPlanGoodsRows.forEach(goods => {
@@ -13409,14 +13441,29 @@ export default {
}),
];
const firstGoods = goodsRows[0] || {};
const quantitySum = goodsRows.reduce(
(sum, goods) => sum + this.parseDispatchQuantity(goods.quantity),
0
);
const quantityText = quantitySum
? this.formatDispatchQuantity(quantitySum)
: firstGoods.quantity || this.dispatchItemForm.quantity || '';
const otherFeeTotal = this.normalizeDispatchFeeValue(this.dispatchItemForm.otherFeeTotal);
const nextRow = {
...this.dispatchItemForm,
goodsJson: JSON.stringify(goodsRows),
cargoType: firstGoods.cargoType || this.dispatchItemForm.cargoType || '',
cargoTypeCode: firstGoods.cargoTypeCode || this.dispatchItemForm.cargoTypeCode || '',
cargoTypePath: firstGoods.cargoTypePath || this.dispatchItemForm.cargoTypePath || [],
cargoName: firstGoods.cargoName || this.dispatchItemForm.cargoName || '',
quantity: firstGoods.quantity || this.dispatchItemForm.quantity || '',
cargoName:
goodsRows
.map(goods => goods.cargoName || goods.goodsName || '')
.filter(Boolean)
.join('.') ||
firstGoods.cargoName ||
this.dispatchItemForm.cargoName ||
'',
quantity: quantityText,
quantityUnit: firstGoods.quantityUnit || this.dispatchItemForm.quantityUnit || '',
unitPrice: firstGoods.unitPrice || '',
priceUnit: firstGoods.priceUnit || '',
@@ -13424,7 +13471,7 @@ export default {
freightJson: JSON.stringify({
currency: this.dispatchItemForm.freightCurrency || 'CNY',
totalFreightAmount: this.dispatchItemFreightSubtotal,
otherFreightAmount: this.dispatchItemForm.otherFeeTotal || '',
otherFreightAmount: otherFeeTotal,
freightItems: goodsRows.map((cargo, index) => ({
cargoIndex: index,
cargoName: cargo.cargoName || '',
@@ -13440,7 +13487,7 @@ export default {
};
nextRow.cargoInfo = this.formatDispatchCargoInfo({}, nextRow);
nextRow.freight = this.getDispatchFeeFields({}, nextRow).freight;
nextRow.otherFeeTotal = this.dispatchItemForm.otherFeeTotal || '';
nextRow.otherFeeTotal = otherFeeTotal;
const quantityUnit = this.getDispatchQuantityUnit(nextRow);
const otherDispatchedQuantity = this.dispatchRows.reduce((total, row, index) => {
if (
@@ -1,94 +1,102 @@
<template>
<section
class="contract-manage-form__section contract-manage-form__section--panel contract-manage-form__section--attachment"
>
<div class="contract-manage-form__attachment-head">
<div class="dialog-section-title">{{ title }}</div>
<el-button type="primary" :disabled="!rows.length" @click="batchDownload">批量下载</el-button>
</div>
<el-table
:data="rows"
border
class="contract-manage-form__attachment-table"
@selection-change="selected = $event"
<div class="contract-attachment-section">
<section
v-if="!dialogOnly"
class="contract-manage-form__section contract-manage-form__section--panel contract-manage-form__section--attachment"
>
<el-table-column v-if="!readonly" type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column v-if="attachmentType" label="附件类型" min-width="160" align="center">
<template #default="{ row }">
<span v-if="readonly || isRowLocked(row)">{{ row.fileType || '-' }}</span>
<el-select
v-else
:model-value="row.fileType"
placeholder="请选择"
:teleported="false"
:fit-input-width="true"
@update:model-value="value => updateRowFileType(row, value)"
>
<el-option
v-for="item in contractAttachmentTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column
label="文件名"
min-width="240"
align="left"
header-align="left"
show-overflow-tooltip
<div class="contract-manage-form__attachment-head">
<div class="dialog-section-title">{{ title }}</div>
<el-button type="primary" :disabled="!rows.length" @click="batchDownload"
>批量下载</el-button
>
</div>
<el-table
:data="rows"
border
class="contract-manage-form__attachment-table"
@selection-change="selected = $event"
>
<template #default="{ row }">
<el-link type="primary" @click="preview?.(row, rows)">{{ attachmentName(row) }}</el-link>
</template>
</el-table-column>
<el-table-column v-if="description" label="附件描述" min-width="220">
<template #default="{ row }">
<span v-if="readonly || isRowLocked(row)">{{ row.description || '-' }}</span>
<el-input
v-else
:model-value="row.description"
maxlength="200"
@update:model-value="value => updateRowDescription(row, value)"
/>
</template>
</el-table-column>
<el-table-column label="文件大小" width="120" align="center">
<template #default="{ row }">{{ formatSize(row.size) }}</template>
</el-table-column>
<el-table-column prop="uploadUserName" label="上传人" width="140" align="center" />
<el-table-column prop="uploadTime" label="上传时间" width="180" align="center" sortable />
<el-table-column v-if="!readonly" label="操作" width="100" align="center" fixed="right">
<template #default="{ row, $index }">
<span v-if="isRowLocked(row)">-</span>
<el-link v-else type="danger" @click="remove($index)">删除</el-link>
</template>
</el-table-column>
</el-table>
<el-table-column v-if="!readonly" type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column v-if="attachmentType" label="附件类型" min-width="160" align="center">
<template #default="{ row, $index }">
<span v-if="readonly || isRowLocked(row)">{{ row.fileType || '-' }}</span>
<el-select
v-else
:model-value="row.fileType"
placeholder="请选择"
style="width: 100%"
teleported
clearable
@update:model-value="value => updateRowFileType($index, value)"
>
<el-option
v-for="item in contractAttachmentTypeOptions"
:key="`${item.value}-${item.label}`"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column
label="文件名"
min-width="240"
align="left"
header-align="left"
show-overflow-tooltip
>
<template #default="{ row }">
<el-link type="primary" @click="preview?.(row, rows)">{{
attachmentName(row)
}}</el-link>
</template>
</el-table-column>
<el-table-column v-if="description" label="附件描述" min-width="220">
<template #default="{ row, $index }">
<span v-if="readonly || isRowLocked(row)">{{ row.description || '-' }}</span>
<el-input
v-else
:model-value="row.description"
maxlength="200"
@update:model-value="value => updateRowDescription($index, value)"
/>
</template>
</el-table-column>
<el-table-column label="文件大小" width="120" align="center">
<template #default="{ row }">{{ formatSize(row.size) }}</template>
</el-table-column>
<el-table-column prop="uploadUserName" label="上传人" width="140" align="center" />
<el-table-column prop="uploadTime" label="上传时间" width="180" align="center" sortable />
<el-table-column v-if="!readonly" label="操作" width="100" align="center" fixed="right">
<template #default="{ row, $index }">
<span v-if="isRowLocked(row)">-</span>
<el-link v-else type="danger" @click="remove($index)">删除</el-link>
</template>
</el-table-column>
</el-table>
<div v-if="!readonly" class="contract-manage-form__attachment-upload">
<template v-if="useUploadDialog">
<el-button type="primary" plain @click="openUploadDialog">上传附件</el-button>
<span class="contract-manage-form__attachment-tip">
支持pdf、bmp、jpeg、png、jpg、doc、docx、ppt、pptx、xlsx、xls、eml、msg、zip的文件格式,单个文件不超过50M
</span>
</template>
<vehicle-attachment-upload
v-else
:model-value="rows"
:file-types="attachmentFileTypes"
:max-size="50"
show-tip
tip="支持pdf、bmp、jpeg、png、jpg、doc、docx、ppt、pptx、xlsx、xls、eml、msg、zip的文件格式,单个文件不超过50M"
:show-file-list="false"
button-text="上传附件"
@update:model-value="handleChange"
@change="handleChange"
/>
</div>
<div v-if="!readonly" class="contract-manage-form__attachment-upload">
<template v-if="useUploadDialog">
<el-button type="primary" plain @click="openUploadDialog">上传附件</el-button>
<span class="contract-manage-form__attachment-tip">
支持pdf、bmp、jpeg、png、jpg、doc、docx、ppt、pptx、xlsx、xls、eml、msg、zip的文件格式,单个文件不超过50M
</span>
</template>
<vehicle-attachment-upload
v-else
:model-value="rows"
:file-types="attachmentFileTypes"
:max-size="50"
show-tip
tip="支持pdf、bmp、jpeg、png、jpg、doc、docx、ppt、pptx、xlsx、xls、eml、msg、zip的文件格式,单个文件不超过50M"
:show-file-list="false"
button-text="上传附件"
@change="handleChange"
@success="handleUploadSuccess"
/>
</div>
</section>
<el-dialog
v-model="uploadDialogVisible"
@@ -103,8 +111,18 @@
<div class="contract-attachment-upload-dialog__body">
<div class="contract-attachment-upload-dialog__field">
<span class="contract-attachment-upload-dialog__label">附件位置</span>
<el-select :model-value="attachmentLocation" disabled style="width: 100%">
<el-option :label="attachmentLocation" :value="attachmentLocation" />
<el-select
v-model="uploadDialogLocation"
placeholder="请选择附件位置"
style="width: 100%"
@change="syncUploadDialogTypeByLocation"
>
<el-option
v-for="item in resolvedLocationOptions"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</div>
<div class="contract-attachment-upload-dialog__field">
@@ -144,7 +162,7 @@
</div>
</template>
</el-dialog>
</section>
</div>
</template>
<script>
@@ -154,11 +172,11 @@ import { getUploadHeaders } from '@/utils/upload';
import { downloadFileByUrl } from '@/utils/util';
import { getDictionary as getBizDictionary } from '@/api/system/dictbiz';
const CONTRACT_ATTACHMENT_TYPE_OTHER = '其它文件';
const CONTRACT_ATTACHMENT_TYPE_OTHER = '其他文件';
export const defaultContractAttachmentTypeOptions = [
{ label: '合同文件', value: '合同文件' },
{ label: '双章归档文件', value: '双章归档文件' },
{ label: '其它文件', value: CONTRACT_ATTACHMENT_TYPE_OTHER },
{ label: '其他文件', value: CONTRACT_ATTACHMENT_TYPE_OTHER },
];
/** @deprecated 兼容旧引用,实际选项由业务字典 contract_attachment_type 动态加载 */
export const contractAttachmentTypeOptions = defaultContractAttachmentTypeOptions;
@@ -201,21 +219,32 @@ const normalizeAttachmentTypeText = value => {
.replace(/[\s_\-—–·•()()\[\]【】{}《》<>“”"'、,,。.]/g, '');
};
const isOtherAttachmentTypeOption = item => {
const text = `${item?.label || ''}${item?.value || ''}`;
return (
String(item?.value) === CONTRACT_ATTACHMENT_TYPE_OTHER ||
String(item?.value) === '其它文件' ||
text.includes('其他文件') ||
text.includes('其它文件') ||
text.includes('其他') ||
text.includes('其它')
);
};
const attachmentTypeKeywords = fileType => {
if (fileType === '双章归档文件') return ['双章归档文件', '双章归档', '双章'];
if (fileType === '合同文件') return ['合同文件', '合同'];
return [fileType];
const text = String(fileType || '');
if (text.includes('双章')) return ['双章归档文件', '双章归档', '双章'];
if (text.includes('合同') && !text.includes('其他') && !text.includes('其它')) {
return ['合同文件', '合同'];
}
if (isOtherAttachmentTypeOption({ label: text, value: text })) return [];
return text ? [text] : [];
};
const resolveOtherAttachmentType = (options = []) => {
const list = options.length ? options : defaultContractAttachmentTypeOptions;
const matched = list.find(
item =>
String(item.value) === CONTRACT_ATTACHMENT_TYPE_OTHER ||
String(item.label).includes('其它') ||
String(item.label).includes('其他')
);
return matched?.value || list[list.length - 1]?.value || CONTRACT_ATTACHMENT_TYPE_OTHER;
const matched = list.find(isOtherAttachmentTypeOption);
return matched?.value || CONTRACT_ATTACHMENT_TYPE_OTHER;
};
export const resolveContractAttachmentType = (
@@ -223,22 +252,27 @@ export const resolveContractAttachmentType = (
options = defaultContractAttachmentTypeOptions
) => {
const list = options.length ? options : defaultContractAttachmentTypeOptions;
const otherType = resolveOtherAttachmentType(list);
const values = list.map(item => item.value);
if (values.includes(row.fileType)) return row.fileType;
const matchedByLabel = list.find(item => String(item.label) === String(row.fileType));
if (matchedByLabel) return matchedByLabel.value;
const fileName = normalizeAttachmentTypeText(attachmentName(row));
const otherType = resolveOtherAttachmentType(list);
if (!fileName) return otherType;
const matched = list
.filter(item => item.value !== otherType)
.filter(item => !isOtherAttachmentTypeOption(item))
.flatMap(item =>
attachmentTypeKeywords(item.value).map(keyword => ({
value: item.value,
keyword: normalizeAttachmentTypeText(keyword),
}))
attachmentTypeKeywords(item.value)
.concat(attachmentTypeKeywords(item.label))
.map(keyword => ({
value: item.value,
keyword: normalizeAttachmentTypeText(keyword),
}))
)
.filter(item => item.keyword)
.sort((a, b) => b.keyword.length - a.keyword.length)
.find(item => fileName.includes(item.keyword));
// 文件名未命中任何附件类型时,默认「其他文件」
return matched?.value || otherType;
};
@@ -272,16 +306,19 @@ export default {
lockApproved: Boolean,
markApprovedOnUpload: Boolean,
useUploadDialog: Boolean,
dialogOnly: Boolean,
attachmentLocation: { type: String, default: '合同文件' },
attachmentLocationOptions: { type: Array, default: null },
preview: { type: Function, default: null },
},
emits: ['update:rows'],
emits: ['update:rows', 'upload-to-location', 'upload-confirmed'],
data() {
return {
selected: [],
attachmentFileTypes,
contractAttachmentTypeOptions: [...defaultContractAttachmentTypeOptions],
uploadDialogVisible: false,
uploadDialogLocation: '合同文件',
uploadDialogType: resolveOtherAttachmentType(defaultContractAttachmentTypeOptions),
uploadDialogFiles: [],
uploadDialogFileList: [],
@@ -300,6 +337,11 @@ export default {
defaultAttachmentType() {
return resolveOtherAttachmentType(this.contractAttachmentTypeOptions);
},
resolvedLocationOptions() {
const options = (this.attachmentLocationOptions || []).filter(Boolean);
if (options.length) return options;
return ['合同文件', '其它附件'];
},
},
created() {
this.loadAttachmentTypeOptions();
@@ -311,12 +353,28 @@ export default {
.then(res => {
const options = mapDictOptions(res);
if (options.length) {
this.contractAttachmentTypeOptions = options;
// 字典缺少「其他文件」时补上,保证未匹配文件名可默认选中
this.contractAttachmentTypeOptions = options.some(isOtherAttachmentTypeOption)
? options
: [...options, { label: '其他文件', value: CONTRACT_ATTACHMENT_TYPE_OTHER }];
if (
!options.some(item => String(item.value) === String(this.uploadDialogType))
!this.contractAttachmentTypeOptions.some(
item => String(item.value) === String(this.uploadDialogType)
)
) {
this.uploadDialogType = this.defaultAttachmentType;
}
// 字典加载后,把已有行的中文类型名对齐到 dictKey,保证下拉可选中
if (this.attachmentType && (this.rows || []).length) {
const aligned = (this.rows || []).map(row => ({
...row,
fileType: resolveContractAttachmentType(row, this.contractAttachmentTypeOptions),
}));
const changed = aligned.some(
(row, index) => row.fileType !== this.rows[index]?.fileType
);
if (changed) this.update(aligned);
}
}
})
.catch(() => {
@@ -327,20 +385,76 @@ export default {
return this.lockApproved && isAttachmentApproved(row);
},
update(rows) {
this.$emit('update:rows', rows);
this.$emit('update:rows', Array.isArray(rows) ? rows.map(item => ({ ...item })) : []);
},
updateRowFileType(row, value) {
if (this.isRowLocked(row)) return;
row.fileType = value;
this.update([...this.rows]);
enrichUploadedRow(row, existing) {
const uploadUserName = this.$store.getters.userInfo?.realName || '';
const uploadTime = this.$dayjs().format('YYYY-MM-DD HH:mm:ss');
const next = {
...existing,
...row,
description: row.description || existing?.description || '',
uploadUserName: existing?.uploadUserName || row.uploadUserName || uploadUserName,
uploadTime: existing?.uploadTime || row.uploadTime || uploadTime,
approved: existing?.approved || row.approved || false,
};
if (this.attachmentType) {
next.fileType = existing?.fileType
? existing.fileType
: resolveContractAttachmentType(
{ ...next, fileType: '' },
this.contractAttachmentTypeOptions
);
}
if (this.markApprovedOnUpload && !existing) next.approved = true;
return next;
},
updateRowDescription(row, value) {
if (this.isRowLocked(row)) return;
row.description = value;
this.update([...this.rows]);
findExistingRow(row, rows = this.rows) {
const fileUrl = attachmentUrl(row);
return (rows || []).find(item => {
const sameUid = row.uid && item.uid && String(row.uid) === String(item.uid);
const sameUrl = fileUrl && attachmentUrl(item) === fileUrl;
return sameUid || sameUrl;
});
},
updateRowFileType(index, value) {
const rows = [...(this.rows || [])];
const row = rows[index];
if (!row || this.isRowLocked(row)) return;
rows[index] = { ...row, fileType: value };
this.update(rows);
},
updateRowDescription(index, value) {
const rows = [...(this.rows || [])];
const row = rows[index];
if (!row || this.isRowLocked(row)) return;
rows[index] = { ...row, description: value };
this.update(rows);
},
resolveTypeByLocation(location) {
const options = this.contractAttachmentTypeOptions || [];
const locationText = String(location || '');
if (locationText.includes('其它') || locationText.includes('其他')) {
return this.defaultAttachmentType;
}
const matched = options.find(
item =>
String(item.value) === locationText ||
String(item.label) === locationText ||
String(item.value).includes('合同') ||
String(item.label).includes('合同')
);
return matched?.value || options[0]?.value || this.defaultAttachmentType;
},
syncUploadDialogTypeByLocation() {
this.uploadDialogType = this.resolveTypeByLocation(this.uploadDialogLocation);
},
openUploadDialog() {
this.uploadDialogType = this.defaultAttachmentType;
const options = this.resolvedLocationOptions;
this.uploadDialogLocation = options.includes(this.attachmentLocation)
? this.attachmentLocation
: options[0] || this.attachmentLocation;
this.syncUploadDialogTypeByLocation();
this.uploadDialogFiles = [];
this.uploadDialogFileList = [];
this.uploadDialogVisible = true;
@@ -348,7 +462,8 @@ export default {
resetUploadDialog() {
this.uploadDialogFiles = [];
this.uploadDialogFileList = [];
this.uploadDialogType = this.defaultAttachmentType;
this.uploadDialogLocation = this.attachmentLocation;
this.syncUploadDialogTypeByLocation();
},
beforeUpload(file) {
const extension = String(file.name || '')
@@ -391,13 +506,18 @@ export default {
...this.uploadDialogFiles.filter(item => String(item.uid) !== String(file.uid)),
normalized,
];
this.uploadDialogType = resolveContractAttachmentType(
{
...normalized,
fileType: '',
},
this.contractAttachmentTypeOptions
);
const locationText = String(this.uploadDialogLocation || '');
if (!(locationText.includes('其它') || locationText.includes('其他'))) {
this.uploadDialogType = resolveContractAttachmentType(
{
...normalized,
fileType: '',
},
this.contractAttachmentTypeOptions
);
} else {
this.uploadDialogType = this.defaultAttachmentType;
}
this.$message.success('上传成功');
},
handleDialogError() {
@@ -416,6 +536,10 @@ export default {
this.$message.warning('请先上传附件');
return;
}
if (!this.uploadDialogLocation) {
this.$message.warning('请选择附件位置');
return;
}
if (!this.uploadDialogType) {
this.$message.warning('请选择附件类型');
return;
@@ -430,43 +554,39 @@ export default {
uploadTime: row.uploadTime || uploadTime,
...(this.markApprovedOnUpload ? { approved: true } : {}),
}));
this.update([...(this.rows || []), ...appended]);
// 统一交给父组件按附件位置写入对应列表,避免同位置双写或跨位置不显示
this.$emit('upload-to-location', {
location: this.uploadDialogLocation,
rows: appended,
});
this.uploadDialogVisible = false;
this.$emit('upload-confirmed', {
location: this.uploadDialogLocation,
rows: appended,
});
},
handleChange(rows) {
const uploadUserName = this.$store.getters.userInfo?.realName || '';
const uploadTime = this.$dayjs().format('YYYY-MM-DD HH:mm:ss');
handleChange(list) {
if (!Array.isArray(list)) return;
// 上传组件偶发回传空列表时,禁止清空已有表格数据
if (!list.length) return;
const existingRows = this.rows || [];
this.update(
(rows || []).map(row => {
const fileUrl = attachmentUrl(row);
const existing = existingRows.find(item => {
const sameUid = row.uid && item.uid && String(row.uid) === String(item.uid);
const sameUrl = fileUrl && attachmentUrl(item) === fileUrl;
return sameUid || sameUrl;
});
if (existing && this.isRowLocked(existing)) return { ...existing };
const next = {
...existing,
...row,
description: row.description || existing?.description || '',
uploadUserName: existing?.uploadUserName || row.uploadUserName || uploadUserName,
uploadTime: existing?.uploadTime || row.uploadTime || uploadTime,
approved: existing?.approved || row.approved || false,
};
if (this.attachmentType) {
next.fileType = resolveContractAttachmentType(
{
...next,
fileType: existing?.fileType || row.fileType,
},
this.contractAttachmentTypeOptions
);
}
if (this.markApprovedOnUpload && !existing) next.approved = true;
return next;
})
);
const nextRows = list.map(row => {
const existing = this.findExistingRow(row, existingRows);
if (existing && this.isRowLocked(existing)) return { ...existing };
return this.enrichUploadedRow(row, existing);
});
existingRows.forEach(item => {
if (!this.isRowLocked(item)) return;
if (this.findExistingRow(item, nextRows)) return;
nextRows.unshift({ ...item });
});
this.update(nextRows);
},
handleUploadSuccess(file) {
const url = attachmentUrl(file);
if (!file || !url) return;
if (this.findExistingRow(file)) return;
this.update([...(this.rows || []), this.enrichUploadedRow(file)]);
},
remove(index) {
const row = this.rows[index];
@@ -474,7 +594,7 @@ export default {
this.$message.warning('已审核通过的附件不允许删除');
return;
}
const rows = [...this.rows];
const rows = [...(this.rows || [])];
rows.splice(index, 1);
this.update(rows);
},
@@ -487,7 +607,7 @@ export default {
downloadFileByUrl(url, attachmentName(row));
},
batchDownload() {
(this.selected.length ? this.selected : this.rows).forEach(this.download);
(this.selected.length ? this.selected : this.rows || []).forEach(this.download);
},
formatSize(size) {
const value = Number(size);
@@ -504,7 +624,7 @@ export default {
.contract-manage-form__section {
margin: 12px 0 0;
padding: 14px 16px 16px;
overflow: hidden;
overflow: visible;
background: #fff;
border-radius: 6px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
@@ -527,6 +647,15 @@ export default {
}
}
.contract-manage-form__attachment-table {
:deep(.el-table__body-wrapper),
:deep(.el-table__header-wrapper),
:deep(.el-table__cell),
:deep(.cell) {
overflow: visible;
}
}
.contract-manage-form__attachment-head {
display: flex;
align-items: center;
@@ -1,8 +1,61 @@
<template>
<div v-loading="loading" class="master-detail">
<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>
<dl class="detail-meta"><div><dt>客户</dt><dd>{{ master.customerName || '-' }}</dd></div><div><dt>合同编号</dt><dd>{{ master.contractNo || '-' }}</dd></div><div><dt>项目</dt><dd>{{ master.projectName || '-' }}</dd></div><div class="detail-meta__attachments"><dt>附件</dt><dd><template v-if="attachments.length"><el-link v-for="file in attachments" :key="file.url || file.link || file.name || file.originalName" type="primary" @click="previewAttachment(file)">{{ attachmentName(file) }}</el-link></template><span v-else>-</span></dd></div></dl>
<div class="detail-heading">
<div>
<h2>多联总单详情 <span>|</span> {{ master.masterNo }}</h2>
<el-tag :type="statusType(master.businessStatus)">{{
statusName(master.businessStatus)
}}</el-tag>
<el-tag v-if="transportFlowLabel" type="primary" class="transport-flow-tag">{{
transportFlowLabel
}}</el-tag>
</div>
</div>
<dl class="detail-meta">
<div>
<dt>客户</dt>
<dd>
<el-link v-if="master.customerName" type="primary" @click="openCustomer">{{
master.customerName
}}</el-link>
<span v-else>-</span>
</dd>
</div>
<div>
<dt>合同编号</dt>
<dd>
<el-link v-if="master.contractNo && master.contractId" type="primary" @click="openContract">{{
master.contractNo
}}</el-link>
<span v-else>{{ master.contractNo || '-' }}</span>
</dd>
</div>
<div>
<dt>项目</dt>
<dd>
<el-link v-if="master.projectName && master.projectId" type="primary" @click="openProject">{{
master.projectName
}}</el-link>
<span v-else>{{ master.projectName || '-' }}</span>
</dd>
</div>
<div class="detail-meta__attachments">
<dt>附件</dt>
<dd>
<template v-if="attachments.length">
<el-link
v-for="file in attachments"
:key="file.url || file.link || file.name || file.originalName"
type="primary"
@click="previewAttachment(file)"
>{{ attachmentName(file) }}</el-link
>
</template>
<span v-else>-</span>
</dd>
</div>
</dl>
<div class="route-map"><template v-for="(route, index) in segments" :key="route.segmentNo"><div class="route-map__node"><span :class="['route-badge', index ? 'middle' : 'start']">{{ index ? '经' : '起' }}</span><strong>{{ segmentLocationName(route, 'departure') }}</strong><small>{{ route.departureAddress || '-' }}</small><small class="route-map__progress">{{ index ? `已到达 ${quantity(segments[index - 1].arrivedQuantity)}/${quantity(master.totalQuantity)} ${plannedUnit(segments[index - 1])}` : `已调度 ${quantity(route.dispatchedQuantity)}/${quantity(master.totalQuantity)} ${plannedUnit(route)}` }}</small><small v-if="index" class="route-map__progress">已调度 {{ quantity(route.dispatchedQuantity) }}/{{ quantity(master.totalQuantity) }} {{ plannedUnit(route) }}</small></div><div class="route-map__line"></div><div v-if="index === segments.length - 1" class="route-map__node"><span class="route-badge end">终</span><strong>{{ segmentLocationName(route, 'arrival') }}</strong><small>{{ route.arrivalAddress || '-' }}</small><small class="route-map__progress">已到达 {{ quantity(route.arrivedQuantity) }}/{{ quantity(master.totalQuantity) }} {{ plannedUnit(route) }}</small></div></template></div>
</section>
@@ -42,6 +95,8 @@
<script>
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 { ElImageViewer } from 'element-plus';
import { OpenFileViewer } from '@open-file-viewer/vue';
@@ -51,10 +106,26 @@ import pdfWorkerSrc from 'pdfjs-dist/build/pdf.worker.mjs?url';
const viewerPlugins = [imagePlugin(), pdfPlugin({ workerSrc: pdfWorkerSrc, useFetchData: true }), officePlugin({ pdf: { workerSrc: pdfWorkerSrc, useFetchData: true } }), textPlugin(), fallbackPlugin()];
const 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 {
components: { ElImageViewer, OpenFileViewer },
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 } }; },
computed: {
segments() {
@@ -71,6 +142,7 @@ export default {
dateRange() { return this.master?.planStartTime && this.master?.planEndTime ? `${String(this.master.planStartTime).slice(0, 10)} ~ ${String(this.master.planEndTime).slice(0, 10)}` : '-'; },
},
async mounted() {
if (!this.id) return;
this.loading = true;
try {
const res = await api.getDetail(this.id);
@@ -148,6 +220,68 @@ export default {
this.$router.push({ path: '/business/waybill-manage/detail', query: { id: row.id } });
},
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 || '-'; },
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 || '-'; },
@@ -159,9 +293,37 @@ export default {
<style scoped lang="scss">
.master-detail { padding-bottom: 20px; color: #303133; }
.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; } }
.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-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;
}
:deep(.el-tag) {
height: 28px;
padding: 0 12px;
border: 0;
border-radius: 8px;
font-size: 13px;
line-height: 28px;
}
}
.transport-flow-tag {
margin-left: 8px;
}
.detail-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 24px; margin: 0; padding: 0 24px 20px; dt { margin-bottom: 6px; color: #909399; font-size: 13px; } dd { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; color: #303133; font-size: 14px; word-break: break-all; } :deep(.el-link) { font-size: 14px; } }
.route-map { display: flex; align-items: flex-start; padding: 16px 24px 20px; border-top: 1px solid #eff1f7; overflow-x: auto; }
.route-map__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; }
@@ -95,10 +95,51 @@
<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-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"><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="remainingQuantity" column-key="remainingQuantity" label="剩余数量" width="150" class-name="goods-table__remaining"><template #default="{ row }">{{ formatQuantity(goodsRemainingQuantity(route, row)) }}</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 min-width="180"
><template #header
><span>货物类型<span class="goods-required-mark">*</span></span></template
><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="packageType" label="包装" min-width="110" />
<el-table-column prop="brand" label="品牌" min-width="110" />
@@ -115,11 +156,11 @@
<el-row :gutter="16">
<template v-if="isRoad(route)">
<el-col :span="6"><el-form-item label="承运商" :required="route.carrierType !== '自运'"><el-select :model-value="route.carrierType !== '自运' ? route.carrierContractId : route.carrierName" filterable clearable placeholder="请选择" :loading="carrierLoading" @change="value => handleCarrierContractChange(route, value)"><el-option v-for="item in carrierOptions" :key="carrierOptionValue(item)" :label="carrierOptionLabel(item)" :value="route.carrierType !== '自运' ? carrierOptionValue(item) : item.carrierName" /></el-select></el-form-item></el-col>
<el-col :span="6"><el-form-item label="司机" :required="route.carrierType !== '承运商'"><el-autocomplete :ref="element => setDriverInput(route.segmentNo, element)" v-model="route.driverName" :debounce="300" :fetch-suggestions="fetchDriverSuggestions" clearable placeholder="请输入司机" :loading="driverLoading" @select="item => handleDriverSuggestionSelect(route, item)" /></el-form-item></el-col>
<el-col :span="6"><el-form-item label="司机" :required="route.carrierType !== '承运商'"><el-autocomplete :ref="element => setDriverInput(route.segmentNo, element)" v-model="route.driverName" :debounce="300" :fetch-suggestions="(query, cb) => fetchDriverSuggestions(route, query, cb)" clearable placeholder="请输入司机" :loading="driverLoading" @select="item => handleDriverSuggestionSelect(route, item)" /></el-form-item></el-col>
<el-col :span="6"><el-form-item :label="route.carrierType === '承运商' ? '手机号' : '司机手机号'" :required="route.carrierType !== '承运商'"><el-input v-model="route.driverPhone" placeholder="请输入" /></el-form-item></el-col>
<el-col :span="6"><el-form-item label="车牌号" required><el-input v-model="route.vehicleNo" placeholder="请输入" /></el-form-item></el-col>
<el-col v-if="route.carrierType !== '承运商'" :span="6"><el-form-item label="挂车车牌号"><el-input v-model="route.trailerVehicleNo" placeholder="请输入" /></el-form-item></el-col>
<el-col v-if="route.carrierType !== '承运商'" :span="6"><el-form-item label="押运人"><el-autocomplete v-model="route.escortName" :debounce="300" :fetch-suggestions="fetchEscortSuggestions" clearable placeholder="请输入" :loading="escortLoading" @select="item => handleEscortSuggestionSelect(route, item)" /></el-form-item></el-col>
<el-col v-if="route.carrierType !== '承运商'" :span="6"><el-form-item label="押运人"><el-autocomplete v-model="route.escortName" :debounce="300" :fetch-suggestions="(query, cb) => fetchEscortSuggestions(route, query, cb)" clearable placeholder="请输入" :loading="escortLoading" @select="item => handleEscortSuggestionSelect(route, item)" /></el-form-item></el-col>
<el-col v-if="route.carrierType !== '承运商'" :span="6"><el-form-item label="押运人手机号"><el-input v-model="route.escortPhone" placeholder="请输入" /></el-form-item></el-col>
</template>
<template v-else>
@@ -192,7 +233,7 @@
<script>
import * as api from '@/api/business/master-order';
import { getList as getDriverList } from '@/api/transportCapacity/driver';
import { fetchDriversByCarrierOrganizations } from '@/utils/carrier-org-resource';
import { isMobile } from '@/utils/validate';
const unwrapRecords = res => {
@@ -208,7 +249,7 @@ export default {
props: { id: [String, Number] },
emits: ['back'],
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: {
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('、') || '-'; },
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(' / ') })); },
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)}` : '-'; },
pendingGroups() {
return this.pending.reduce((groups, item, index) => {
@@ -246,17 +290,17 @@ export default {
},
},
async mounted() {
await Promise.all([this.load(), this.loadCarrierOptions(), this.loadDriverOptions()]);
await Promise.all([this.load(), this.loadCarrierOptions()]);
this.applySelfOperatedCarrierDefaults();
},
methods: {
async load() {
if (!this.id) return;
this.loading = true;
try {
const res = await api.getDetail(this.id);
this.master = res.data?.data || res.data || res;
await this.loadContractCurrency();
this.cargoTypeOptions = this.buildMasterCargoTypeOptions(this.master.goods || []);
this.routes = this.dispatchRouteNodes().map((node, index) => this.createRoute(node, index));
} finally { this.loading = false; }
},
@@ -318,46 +362,42 @@ export default {
this.syncFreightItems(route);
return route;
},
buildMasterCargoTypeOptions(goods = []) {
return [...new Set(goods.map(item => item.cargoType).filter(Boolean))].map(cargoType => ({
id: cargoType,
cargoName: cargoType,
}));
},
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 = []) {
let options = this.cargoTypeOptions;
let selected;
(path || []).forEach(id => {
selected = (options || []).find(item => String(item.id) === String(id));
options = selected?.children || [];
});
return selected;
fetchCargoTypeSuggestions(queryString, callback) {
const keyword = String(queryString || '').trim().toLowerCase();
const options = this.cargoTypeSelectOptions.map(item => ({ value: item }));
callback(
keyword ? options.filter(item => String(item.value).toLowerCase().includes(keyword)) : options
);
},
findCargoTypePath(cargoType, options = this.cargoTypeOptions, parentPath = []) {
for (const option of options || []) {
const path = [...parentPath, option.id];
if (option.cargoName === cargoType) return path;
if (option.children?.length) {
const result = this.findCargoTypePath(cargoType, option.children, path);
if (result.length) return result;
}
}
return [];
handleCargoTypeSelect(route, row, item = {}) {
this.handleCargoTypeChange(route, row, item.value || '');
},
handleCargoTypeChange(route, row, value) {
const path = Array.isArray(value) ? value : [];
const cargoType = this.findCargoTypeByPath(path);
row.cargoTypePath = path;
row.cargoType = cargoType?.cargoName || '';
const firstGoods = this.masterGoodsByCargoType(row)[0];
row.cargoType = String(value ?? row.cargoType ?? '').trim();
const matched = this.masterGoods.filter(item => item.cargoType === row.cargoType);
const firstGoods = matched[0];
if (firstGoods) {
row.sourceIndex = firstGoods.sourceIndex;
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);
},
isRoad(route) {
@@ -542,53 +582,48 @@ export default {
);
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 = {}) {
const routeSegment = route.segmentNo || route.relationNo || '';
const itemSegment = item.segmentNo || item.relationNo || '';
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) {
const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.');
const nextValue = decimal || String(value || '').includes('.') ? `${integer}.${decimal.slice(0, 3)}` : integer;
const availableQuantity = this.availableDispatchQuantity(route, row);
if (Number(nextValue || 0) > availableQuantity) {
row.dispatchQuantity = this.formatQuantity(availableQuantity);
this.syncFreightItems(route);
this.$message.warning('本次数量不能超过剩余数量');
return;
}
row.dispatchQuantity = nextValue;
row.dispatchQuantity =
decimal || String(value || '').includes('.') ? `${integer}.${decimal.slice(0, 3)}` : integer;
this.syncFreightItems(route);
},
validatePendingTotals() {
for (const route of this.routes) {
const items = this.pending.filter(item => this.isSameRouteSegment(route, item));
if (!items.length) continue;
if (!this.validatePreviousSegmentCompletedQuantity(route, [])) return false;
const totals = new Map();
for (const item of items) {
const index = this.masterGoodsIndex(item);
const key = index >= 0 ? `i:${index}` : this.goodsKey(item);
totals.set(key, (totals.get(key) || 0) + this.quantityNumber(item.quantity));
}
for (const [key, qty] of totals.entries()) {
if (!key.startsWith('i:')) continue;
const sourceIndex = Number(key.slice(2));
const masterGoods = this.master?.goods?.[sourceIndex];
if (!masterGoods) continue;
const available = this.baseGoodsRemainingQuantity(route, {
...masterGoods,
sourceIndex,
});
if (qty > available) {
this.$message.warning(
`${route.segmentNo}「${masterGoods.cargoName || ''}」调度总量不能超过剩余数量(${this.formatQuantity(available)} ${masterGoods.quantityUnit || this.quantityUnitLabel})`
);
return false;
}
}
}
return true;
},
handleFreightUnitPriceInput(item, value) {
const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.');
item.unitPrice = decimal || String(value || '').includes('.') ? `${integer}.${decimal.slice(0, 2)}` : integer;
@@ -618,7 +653,7 @@ export default {
const index = (route.goods || []).indexOf(item) + 1;
const fields = [
[!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, '本次数量'],
[!String(item.quantityUnit || '').trim(), '数量单位'],
];
@@ -650,7 +685,6 @@ export default {
return {
...goods,
sourceIndex,
cargoTypePath: this.findCargoTypePath(goods.cargoType),
dispatchQuantity: undefined,
};
},
@@ -666,7 +700,8 @@ export default {
selectGoods(route, row) {
const source = (this.master.goods || [])[Number(row.sourceIndex)];
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);
},
removeGoods(route, index) { route.goods.splice(index, 1); this.syncFreightItems(route); },
@@ -692,6 +727,7 @@ export default {
route.carrierName = '';
route.carrierId = '';
route.carrierContractId = '';
this.clearRouteDriverVehicleFields(route);
if (value === '承运商') {
route.trailerVehicleNo = '';
route.escortName = '';
@@ -711,6 +747,24 @@ export default {
route.carrierContractId = route.carrierType !== '自运' ? contract?.contractId || '' : '';
route.carrierId = route.carrierType !== '自运' ? contract?.carrierId || '' : '';
route.carrierName = contract?.carrierName || '';
this.clearRouteDriverVehicleFields(route);
},
clearRouteDriverVehicleFields(route) {
if (!route) return;
route.driverId = '';
route.driverName = '';
route.driverPhone = '';
route.vehicleNo = '';
route.trailerVehicleNo = '';
route.escortName = '';
route.escortPhone = '';
this.driverOptions = [];
},
getRouteCarrierFilter(route = {}) {
return {
carrierId: route.carrierId || '',
carrierName: route.carrierName || '',
};
},
carrierOptionValue(item = {}) {
return item.contractId || item.id || item.value || item.carrierName || '';
@@ -782,18 +836,30 @@ export default {
route.carrierContractId = '';
});
},
async loadDriverOptions(keyword = '') {
async loadDriverOptions(route = {}, keyword = '') {
const carrier = this.getRouteCarrierFilter(route);
if (!carrier.carrierId && !carrier.carrierName) {
this.driverOptions = [];
return [];
}
this.driverLoading = true;
try {
this.driverOptions = unwrapRecords(
await getDriverList(1, 20, { driverName: keyword, posts: '司机' })
this.driverOptions = await fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '司机' },
carrier
);
return this.driverOptions;
} finally {
this.driverLoading = false;
}
},
fetchDriverSuggestions(queryString, callback) {
this.loadDriverOptions(String(queryString || '').trim())
fetchDriverSuggestions(route, queryString, callback) {
const carrier = this.getRouteCarrierFilter(route);
if (!carrier.carrierId && !carrier.carrierName) {
callback([]);
return;
}
this.loadDriverOptions(route, String(queryString || '').trim())
.then(() =>
callback(
this.driverOptions.map(item => ({
@@ -811,13 +877,21 @@ export default {
const drivingVehicle = String(item.drivingVehicle || '').trim();
if (drivingVehicle) route.vehicleNo = drivingVehicle;
},
fetchEscortSuggestions(queryString, callback) {
fetchEscortSuggestions(route, queryString, callback) {
const keyword = String(queryString || '').trim();
const carrier = this.getRouteCarrierFilter(route);
if (!carrier.carrierId && !carrier.carrierName) {
callback([]);
return;
}
this.escortLoading = true;
getDriverList(1, 20, { ...(keyword ? { driverName: keyword } : {}), posts: '押运员' })
.then(res => {
fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '押运员' },
carrier
)
.then(records => {
callback(
unwrapRecords(res).map(item => ({
records.map(item => ({
...item,
value: this.driverOptionLabel(item),
}))
@@ -854,8 +928,6 @@ export default {
const goods = route.goods.filter(item => Number(item.dispatchQuantity) > 0);
if (!goods.length) return this.$message.warning('请填写本次数量');
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);
if (!this.validateFreightItems(route)) return;
if (!this.validateRoutePhones(route)) return;
@@ -954,6 +1026,7 @@ export default {
async submit() {
if (!this.pending.length) return this.$message.warning('请加入待提交调度清单');
if (this.pending.some(item => !this.validateRoutePhones(item))) return;
if (!this.validatePendingTotals()) return;
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; }
},
@@ -985,7 +1058,7 @@ export default {
.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; } }
.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; }
.freight-form { :deep(.freight-unit-select) { width: 92px; flex: 0 0 92px; min-width: 0; } }
.carrier-type-form { margin-top: 16px; }
@@ -402,8 +402,8 @@
>
</div>
<div class="map-picker-content">
<map-search-results :results="mapSearchResults" @select="selectAddressMapSearchResult" />
<div ref="addressMap" class="address-map" />
<map-search-results :results="mapSearchResults" @select="selectAddressMapSearchResult" />
</div>
<div class="address-map-status">
{{ mapStatus
@@ -601,6 +601,7 @@ let amapLoader;
import { getList as getCommonRouteList } from '@/api/business/common-route';
import * as api from '@/api/business/master-order';
import { formatUpdateUserName } from '@/utils/audit';
import { normalizeMapSearchResults } from '@/utils/map-search';
import { isMobile } from '@/utils/validate';
export default {
components: {
@@ -1285,14 +1286,8 @@ export default {
)
)
.then(result => {
const geocodes = result?.geocodes || [];
this.mapSearchResults = geocodes.map((item, index) => ({
id: item.id || index,
name: item.formattedAddress || this.mapKeyword,
address: item.formattedAddress || this.mapKeyword,
location: item.location,
}));
const point = geocodes[0]?.location;
this.mapSearchResults = normalizeMapSearchResults(result, this.mapKeyword);
const point = this.mapSearchResults[0]?.location;
if (!point) return this.$message.warning('地图搜索无匹配地址');
this.pickAddressMap(point, this.mapKeyword);
})
@@ -2199,8 +2194,15 @@ export default {
display: flex;
gap: 8px;
margin-bottom: 12px;
.el-input {
flex: 1;
min-width: 0;
}
}
.address-map {
width: 100%;
min-width: 0;
height: 440px;
}
.address-map-status {
@@ -146,8 +146,9 @@
/>
<el-input
v-model="form.departureAddress"
placeholder="请输入发货地址"
:readonly="transportStationMode || !config.editableRoadAddress"
class="shipping-template-page__address-map-input"
readonly
placeholder="请选择发货地址"
:disabled="transportAddressSelectDisabled"
@click="handleTransportSecondaryAddressInputClick('departure')"
>
@@ -189,8 +190,9 @@
/>
<el-input
v-model="form.arrivalAddress"
placeholder="请输入收货地址"
:readonly="transportStationMode || !config.editableRoadAddress"
class="shipping-template-page__address-map-input"
readonly
placeholder="请选择收货地址"
:disabled="transportAddressSelectDisabled"
@click="handleTransportSecondaryAddressInputClick('arrival')"
>
@@ -929,11 +931,11 @@
/><el-button type="primary" @click="searchTransportMapKeyword">搜索</el-button>
</div>
<div class="map-picker-content">
<div ref="transportMap" class="shipping-template-page__map" />
<map-search-results
:results="transportMapSearchResults"
@select="selectTransportMapSearchResult"
/>
<div ref="transportMap" class="shipping-template-page__map" />
</div>
<div class="shipping-template-page__map-info">{{ transportMapStatus }}</div>
<template #footer
@@ -1096,6 +1098,7 @@ import {
import { getDictionary as getSystemDictionary } from '@/api/system/dict';
import { getDictionary } from '@/api/system/dictbiz';
import { packageOptions } from '@/option/business/common';
import { normalizeMapSearchResults } from '@/utils/map-search';
import { downloadFileByUrl, downloadXls } from '@/utils/util';
import { isMobile } from '@/utils/validate';
import { Location } from '@element-plus/icons-vue';
@@ -1131,7 +1134,7 @@ const defaultCargo = () => ({
cargoTypePath: [],
packageType: '',
quantity: '',
quantityUnit: '',
quantityUnit: '吨',
brand: '',
specification: '',
model: '',
@@ -1258,6 +1261,7 @@ export default {
crudDialogType: '',
standaloneFormKey: '',
copyingRow: null,
suppressTransportTypeClear: false,
detailBox: false,
detailLoading: false,
detailRow: {},
@@ -1511,10 +1515,10 @@ export default {
},
},
'form.transportType'(value, oldValue) {
if (value !== oldValue) {
this.handleTransportTypeChange(value);
this.syncFreightItems();
}
if (this.suppressTransportTypeClear) return;
if (String(value ?? '') === String(oldValue ?? '')) return;
this.handleTransportTypeChange(value);
this.syncFreightItems();
},
},
created() {
@@ -1527,6 +1531,20 @@ export default {
methods: {
buildOption(option) {
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.standaloneFormPage &&
@@ -1790,6 +1808,7 @@ export default {
console.log('进入复制模式分支');
const copyData = { ...this.copyingRow };
this.copyingRow = null;
this.suppressTransportTypeClear = true;
this.form = { ...(this.config.defaultForm || {}), ...copyData };
console.log('合并后的 form:', this.form);
// 删除模板编号,等待系统生成
@@ -1842,7 +1861,11 @@ export default {
done?.();
},
applyFormDetail(row) {
this.suppressTransportTypeClear = true;
this.form = { ...(row || {}) };
this.$nextTick(() => {
this.suppressTransportTypeClear = false;
});
this.selectedProjectId = this.form.projectId || '';
this.transportCargoRows = this.parseJsonArray(this.form.goodsJson).map(item =>
this.normalizeCargo(item)
@@ -1924,14 +1947,6 @@ export default {
this.$message.warning(`第${index + 1}行货物类型不能为空`);
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) {
this.$message.warning(`第${index + 1}行备注不能超过200个字符`);
return false;
@@ -2013,6 +2028,8 @@ export default {
delete detail.updateUser;
delete detail.updateUserName;
delete detail.status;
// 模板名称追加「-副本」
detail.templateName = `${detail.templateName || ''}-副本`;
console.log('处理后的数据:', detail);
console.log('isStandaloneBusinessPage:', this.isStandaloneBusinessPage);
@@ -2286,13 +2303,60 @@ export default {
},
handleTransportTypeChange(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) {
if (this.transportStationMode) this.openTransportStationDialog(target);
},
handleTransportSecondaryAddressInputClick(target) {
if (this.transportStationMode || !this.config.editableRoadAddress)
this.openTransportSecondaryAddressPicker(target);
if (this.transportAddressSelectDisabled) return;
this.openTransportSecondaryAddressPicker(target);
},
openTransportSecondaryAddressPicker(target) {
this.transportStationMode
@@ -2552,12 +2616,7 @@ export default {
.then(() => this.ensureTransportMapGeocoder())
.then(() => this.runTransportMapGeocode('location', keyword))
.then(result => {
this.transportMapSearchResults = (result.geocodes || []).map((item, index) => ({
id: item.id || index,
name: item.formattedAddress || keyword,
address: item.formattedAddress || keyword,
location: item.location,
}));
this.transportMapSearchResults = normalizeMapSearchResults(result, keyword);
const point = this.resolveTransportMapPoint(result);
if (!point) throw new Error('未找到匹配地址');
return this.$nextTick().then(() => {
@@ -3328,6 +3387,13 @@ export default {
gap: 8px;
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 {
display: flex;
gap: 12px;
@@ -3684,6 +3750,12 @@ export default {
.shipping-template-page__map-toolbar {
display: flex;
gap: 8px;
margin-bottom: 12px;
.el-input {
flex: 1;
min-width: 0;
}
}
.shipping-template-page__dialog-search {
margin-bottom: 8px;
@@ -3696,11 +3768,9 @@ export default {
justify-content: flex-end;
}
.shipping-template-page__map {
flex: 1 1 auto;
width: 100%;
min-width: 0;
height: 480px;
margin-top: 12px;
}
:deep(.shipping-template-page__map > .amap-container) {
width: 100% !important;
File diff suppressed because it is too large Load Diff
@@ -10,109 +10,206 @@
:class="{ 'waybill-import-page': standalone }"
@closed="handleClosed"
>
<div class="waybill-import-toolbar">
<div class="waybill-import-toolbar__search">
<el-form :inline="true" :model="query" label-width="auto">
<el-form-item label="运单批次号"
><el-input v-model="query.batchNo" clearable
/></el-form-item>
<el-form-item label="承运商"
><el-select v-model="query.carrierId" clearable filterable
><el-option
<section v-show="searchVisible" class="waybill-import-toolbar__search">
<el-form :model="query" label-position="right" label-width="88px" @submit.prevent>
<div class="waybill-import-toolbar__search-grid">
<el-form-item label="运单批次号">
<el-input v-model="query.batchNo" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="承运商">
<el-select v-model="query.carrierId" clearable filterable placeholder="请选择">
<el-option
v-for="item in queryCarriers"
:key="item.id"
:label="item.name"
:value="item.id" /></el-select
></el-form-item>
<el-form-item label="创建时间"
><el-date-picker
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="query.createTimeRange"
type="datetimerange"
value-format="YYYY-MM-DD HH:mm:ss"
/></el-form-item>
<el-form-item label="创建人"
><el-select v-model="query.createUser" clearable filterable
><el-option
range-separator="~"
start-placeholder="开始时间"
end-placeholder="结束时间"
clearable
/>
</el-form-item>
<el-form-item label="创建人">
<el-select v-model="query.createUser" clearable filterable placeholder="请选择">
<el-option
v-for="item in creators"
:key="item.id"
:label="item.name"
:value="item.id" /></el-select
></el-form-item>
</el-form>
<div class="waybill-import-toolbar__search-actions">
<el-button type="primary" @click="loadBatches">查询</el-button
><el-button @click="resetQuery">重置</el-button>
:value="item.id"
/>
</el-select>
</el-form-item>
</div>
</div>
<div class="waybill-import-toolbar__actions">
<el-button type="primary" @click="handleCreate">新建导入</el-button
><el-button type="danger" plain :disabled="!selected.length" @click="removeBatches"
<div class="waybill-import-toolbar__search-actions">
<el-button type="primary" @click="loadBatches">查询</el-button>
<el-button @click="resetQuery">重置</el-button>
</div>
</el-form>
</section>
<div class="avue-crud__header waybill-import-toolbar__actions">
<div class="avue-crud__left">
<el-button type="primary" @click="handleCreate">新建导入</el-button>
<el-button type="danger" plain :disabled="!selected.length" @click="removeBatches"
>批量删除</el-button
>
</div>
<div class="avue-crud__right">
<el-button icon="el-icon-refresh" circle @click="loadBatches" />
<el-button icon="el-icon-operation" circle @click="columnSettingVisible = true" />
<el-button icon="el-icon-search" circle @click="searchVisible = !searchVisible" />
<el-button icon="el-icon-grid" circle @click="toggleTableSize" />
</div>
</div>
<el-table :data="batches" border @selection-change="selected = $event">
<el-table-column type="selection" width="50" /><el-table-column
type="index"
label="序号"
width="70"
/>
<el-table-column prop="batchNo" label="运单批次号" min-width="150" /><el-table-column
prop="projectName"
label="项目名称"
min-width="150"
/>
<el-table-column prop="carrierName" label="承运商" min-width="140" /><el-table-column
prop="carrierType"
label="承运类型"
min-width="120"
/>
<el-table-column prop="waybillCount" label="运单数" width="90" /><el-table-column
prop="importTypeName"
label="导入方式"
width="100"
/>
<el-table-column
prop="createTime"
label="创建时间"
min-width="170"
sortable
/><el-table-column prop="updateTime" label="更新时间" min-width="170" sortable />
<el-table-column prop="statusName" label="状态" width="100" /><el-table-column
label="操作"
width="180"
fixed="right"
<section class="waybill-import-toolbar__table-panel">
<el-table
:data="batches"
:size="tableSize"
border
@selection-change="selected = $event"
>
<template #default="{ row }"
><el-link type="primary" @click="openDetail(row)">查看</el-link
><el-link
v-if="row.importStatus === 'draft'"
type="primary"
@click="editBatch(row)"
>编辑</el-link
><el-link type="danger" @click="removeBatch(row)">删除</el-link></template
<el-table-column type="selection" width="50" /><el-table-column
type="index"
label="序号"
width="70"
/>
<el-table-column
v-if="columnVisible.batchNo"
prop="batchNo"
label="运单批次号"
min-width="150"
/><el-table-column
v-if="columnVisible.projectName"
prop="projectName"
label="项目名称"
min-width="150"
/>
<el-table-column
v-if="columnVisible.carrierName"
prop="carrierName"
label="承运商"
min-width="140"
/><el-table-column
v-if="columnVisible.carrierType"
prop="carrierType"
label="承运类型"
min-width="120"
/>
<el-table-column
v-if="columnVisible.waybillCount"
prop="waybillCount"
label="运单数"
width="90"
/> <el-table-column
v-if="columnVisible.importTypeName"
prop="importTypeName"
label="导入方式"
width="100"
/>
<el-table-column
v-if="columnVisible.statusName"
prop="statusName"
label="状态"
width="100"
/>
<el-table-column
v-if="columnVisible.createUserName"
prop="createUserName"
label="创建人"
min-width="120"
>
</el-table-column>
</el-table>
<el-pagination
v-model:current-page="page.current"
v-model:page-size="page.size"
layout="total, prev, pager, next, sizes"
:page-sizes="[10, 20, 50]"
:total="page.total"
@current-change="loadBatches"
@size-change="loadBatches"
/>
<template #default="{ row }">{{ row.createUserName || '-' }}</template>
</el-table-column>
<el-table-column
v-if="columnVisible.createTime"
prop="createTime"
label="创建时间"
min-width="170"
sortable
/><el-table-column
v-if="columnVisible.updateTime"
prop="updateTime"
label="更新时间"
min-width="170"
sortable
/>
<el-table-column
label="操作"
width="180"
fixed="right"
>
<template #default="{ row }">
<el-link
v-if="row.importStatus !== 'draft'"
type="primary"
@click="openDetail(row)"
>查看</el-link
>
<el-link
v-if="row.importStatus === 'draft'"
type="primary"
@click="editBatch(row)"
>编辑</el-link
>
<el-link
v-if="row.importStatus === 'draft'"
type="danger"
@click="removeBatch(row)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
<div class="waybill-import-toolbar__pagination">
<el-pagination
background
v-model:current-page="page.current"
v-model:page-size="page.size"
layout="total, sizes, prev, pager, next, jumper"
:page-sizes="[10, 20, 50, 100]"
:total="page.total"
@current-change="loadBatches"
@size-change="loadBatches"
/>
</div>
</section>
</component>
<el-dialog
v-model="columnSettingVisible"
title="列设置"
width="360px"
append-to-body
>
<el-checkbox-group v-model="visibleColumnKeys" class="waybill-import-toolbar__column-setting">
<el-checkbox v-for="item in columnOptions" :key="item.prop" :label="item.prop">
{{ item.label }}
</el-checkbox>
</el-checkbox-group>
<template #footer>
<el-button @click="columnSettingVisible = false">关闭</el-button>
</template>
</el-dialog>
<el-dialog v-model="detailVisible" title="导入运单详情" width="90%" append-to-body>
<el-form :inline="true" :model="detailQuery"
><el-form-item label="车牌号/船号"
<section-card class="waybill-search">
<el-form :inline="true" :model="detailQuery"
>
<el-form-item label="车牌号/船号"
><el-input v-model="detailQuery.vehicleNo" clearable /></el-form-item
><el-form-item label="货物名称"
><el-input v-model="detailQuery.cargoName" clearable /></el-form-item
><el-form-item label="司机/船长姓名"
><el-input v-model="detailQuery.driverName" clearable placeholder="请输入" /></el-form-item
><el-button type="primary" @click="loadDetails">查询</el-button></el-form
>
>
</section-card>
<el-table :data="details" border
><el-table-column type="index" label="序号" width="65" /><el-table-column
prop="batchNo"
@@ -126,7 +223,10 @@
prop="vehicleNo"
label="车牌号/航班号/船号/班列号"
min-width="190"
/><el-table-column prop="transportType" label="运输方式" width="110" /><el-table-column
/><el-table-column prop="transportType" label="运输方式" width="110">
<template #default="{ row }">{{ transportTypeLabel(row.transportType) }}</template>
</el-table-column>
<el-table-column
prop="driverName"
label="司机/船长姓名"
min-width="120"
@@ -200,17 +300,20 @@
prop="waybillIdentifier"
label="同一运单标识号"
min-width="140"
/><el-table-column label="操作" width="80">-</el-table-column></el-table
/></el-table
>
<el-pagination
v-model:current-page="detailPage.current"
v-model:page-size="detailPage.size"
layout="total, prev, pager, next, sizes"
:page-sizes="[10, 20, 50]"
:total="detailPage.total"
@current-change="loadDetails"
@size-change="loadDetails"
/>
<div class="waybill-import-toolbar__pagination">
<el-pagination
background
v-model:current-page="detailPage.current"
v-model:page-size="detailPage.size"
layout="total, sizes, prev, pager, next, jumper"
:page-sizes="[10, 20, 50, 100]"
:total="detailPage.total"
@current-change="loadDetails"
@size-change="loadDetails"
/>
</div>
</el-dialog>
<component
@@ -351,7 +454,7 @@
:on-change="fileChange"
:on-remove="fileRemove"
><el-button type="primary">添加附件</el-button></el-upload
><span class="waybill-import-create__file-tip">请上传运单明细表,仅支持 excel 格式</span
><span class="waybill-import-create__file-tip">请上传运单明细表,仅支持 excel 格式;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法</span
><el-link type="primary" @click="downloadTemplate">下载模板</el-link></el-form-item
>
</el-form>
@@ -494,6 +597,7 @@ import { getList as getDriverList } from '@/api/transportCapacity/driver';
import { getDictionary } from '@/api/system/dictbiz';
import * as api from '@/api/business/waybill-manage';
import { downloadXls } from '@/utils/util';
import SectionCard from '@/components/section-card/main.vue';
const props = defineProps({ modelValue: Boolean, standalone: Boolean, createPage: Boolean });
const emit = defineEmits(['update:modelValue', 'closed']);
@@ -506,8 +610,32 @@ const handleClosed = () => emit('closed');
const createVisible = ref(props.createPage),
detailVisible = ref(false),
formRef = ref();
const searchVisible = ref(true);
const columnSettingVisible = ref(false);
const tableSize = ref('default');
const tableSizeOptions = ['default', 'large', 'small'];
const columnOptions = [
{ prop: 'batchNo', label: '运单批次号' },
{ prop: 'projectName', label: '项目名称' },
{ prop: 'carrierName', label: '承运商' },
{ prop: 'carrierType', label: '承运类型' },
{ prop: 'waybillCount', label: '运单数' },
{ prop: 'importTypeName', label: '导入方式' },
{ prop: 'statusName', label: '状态' },
{ prop: 'createUserName', label: '创建人' },
{ prop: 'createTime', label: '创建时间' },
{ prop: 'updateTime', label: '更新时间' },
];
const visibleColumnKeys = ref(columnOptions.map(item => item.prop));
const columnVisible = computed(() =>
Object.fromEntries(columnOptions.map(item => [item.prop, visibleColumnKeys.value.includes(item.prop)]))
);
const toggleTableSize = () => {
const index = tableSizeOptions.indexOf(tableSize.value);
tableSize.value = tableSizeOptions[(index + 1) % tableSizeOptions.length];
};
const query = reactive({ batchNo: '', carrierId: '', createUser: '', createTimeRange: [] });
const detailQuery = reactive({ vehicleNo: '', cargoName: '' });
const detailQuery = reactive({ vehicleNo: '', driverName: '' });
const createDefaultForm = () => ({
id: '',
batchNo: '',
@@ -862,6 +990,20 @@ const loadEditorOptions = async () => {
cargoTypeFlatOptions.value = flattenCargoTypeOptions(cargoTypeOptions.value);
driverOptions.value = extractRecords(driverRes);
};
const ensureTransportTypeOptions = async () => {
if (transportTypeOptions.value.length) return;
const dictRes = await getDictionary({ code: 'transport_type' });
transportTypeOptions.value = extractRecords(dictRes).map(item => ({
label: item.dictValue || item.label,
value: item.dictKey || item.value,
}));
};
const transportTypeLabel = value => {
if (value === null || value === undefined || value === '') return '-';
return (
transportTypeOptions.value.find(item => String(item.value) === String(value))?.label || value
);
};
const loadBatches = async () => {
const res = await api.getImportBatches({ ...query, current: page.current, size: page.size });
batches.value = res.data?.data?.records || [];
@@ -922,9 +1064,13 @@ const closeCreate = () => {
}
createVisible.value = false;
};
const openDetail = row => {
const openDetail = async row => {
detailQuery.batchId = row.id;
detailQuery.vehicleNo = '';
detailQuery.driverName = '';
detailPage.current = 1;
detailVisible.value = true;
await ensureTransportTypeOptions();
loadDetails();
};
// 草稿明细已落库为草稿运单,编辑时回填到明细表,避免重新上传附件。
@@ -1329,34 +1475,81 @@ const confirmImport = async () => {
<style scoped lang="scss">
.waybill-import-toolbar {
margin-bottom: 12px;
&__search {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 18px 18px 8px;
margin-bottom: 8px;
background: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.el-form {
flex: 1;
margin-bottom: 0;
}
&__search-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 8px 24px;
}
&__search :deep(.el-form-item) {
margin-bottom: 8px;
}
&__search :deep(.el-form-item__label) {
white-space: nowrap;
}
&__search :deep(.el-input),
&__search :deep(.el-select),
&__search :deep(.el-date-editor),
&__search :deep(.el-date-editor.el-input),
&__search :deep(.el-date-editor.el-input__wrapper),
&__search :deep(.el-date-editor--datetimerange) {
width: 100%;
}
&__search-actions {
display: flex;
flex: none;
justify-content: flex-end;
gap: 8px;
margin-bottom: 8px;
}
&__actions {
margin-top: 8px;
margin-top: 12px;
background: transparent;
}
&__column-setting {
display: flex;
flex-direction: column;
gap: 8px;
}
&__table-panel {
padding: 0 12px 12px;
background: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
&__pagination {
display: flex;
justify-content: flex-end;
width: 100%;
box-sizing: border-box;
padding: 16px 0;
}
&__table-panel :deep(.el-table) {
--el-table-border-color: #eff1f7;
}
&__table-panel :deep(.el-table__body tr:nth-child(even) > td.el-table__cell),
&__table-panel :deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--left),
&__table-panel :deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--right) {
background: #fafafa;
}
}
.waybill-import-page {
min-height: calc(100vh - 120px);
padding: 12px 24px 24px;
background: #fff;
}
.waybill-import-create {
@@ -1429,4 +1622,7 @@ const confirmImport = async () => {
:global(.avue-layout--horizontal .waybill-import-create__footer) {
left: 0;
}
.waybill-search .el-form-item{
margin-bottom: 0 !important;
}
</style>
File diff suppressed because it is too large Load Diff
+71 -14
View File
@@ -70,7 +70,7 @@
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="YYYY-MM-DD"
placeholder="请输入"
/>
<span>至</span>
<el-date-picker
@@ -78,7 +78,7 @@
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="YYYY-MM-DD"
placeholder="请输入"
/>
</div>
</el-form-item>
@@ -92,12 +92,12 @@
</el-input>
</el-form-item>
<el-form-item label="合同金额">
<el-input-number
v-model="form.contractAmount"
:min="0"
:precision="2"
:controls="false"
<el-input
:model-value="contractAmountDisplay"
placeholder="请输入"
clearable
@input="handleContractAmountInput"
@clear="form.contractAmount = null"
/>
</el-form-item>
<el-form-item label="是否范本">
@@ -189,10 +189,11 @@
title="合同文件"
description
attachment-type
use-upload-dialog
:attachment-location-options="changeAttachmentLocationOptions"
:rows="contractFileRows"
:preview="previewAttachment"
@update:rows="contractFileRows = $event"
@upload-to-location="handleAttachmentUploadToLocation"
/>
<section class="change-section">
@@ -218,7 +219,7 @@
</el-radio-group>
</div>
<el-form v-if="settlementRule.autoGenerate === 1" :model="settlementRule" label-position="right" label-width="auto" class="settlement-form">
<el-form-item label="账单起始日期" required><el-date-picker v-model="settlementRule.billStartDate" type="date" placeholder="请选择账单起始日期" format="YYYY-MM-DD" value-format="YYYY-MM-DD" /></el-form-item>
<el-form-item label="账单起始日" required><el-date-picker v-model="settlementRule.billStartDate" type="date" placeholder="请选择账单起始日" format="YYYY-MM-DD" value-format="YYYY-MM-DD" /></el-form-item>
<el-form-item label="结算类型" required><el-select v-model="settlementRule.settlementType" placeholder="请选择结算类型" @change="handleSettlementTypeChange"><el-option v-for="item in settlementTypeOptions" :key="item" :label="item" :value="item" /></el-select></el-form-item>
<el-form-item v-if="showSettlementBillCycleType" label="结算周期" required><el-select v-model="settlementRule.billCycleType" placeholder="请选择结算周期" @change="handleCycleTypeChange"><el-option v-for="item in billCycleTypeOptions" :key="item" :label="item" :value="item" /></el-select></el-form-item>
<el-form-item v-if="showSettlementBillCutoffDay" label="账单截单日" required><el-select v-model="settlementRule.billCutoffDay" placeholder="请选择账单截单日"><el-option v-for="item in billCutoffDayOptions" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-form-item>
@@ -256,11 +257,12 @@
title="其它附件"
description
attachment-type
use-upload-dialog
attachment-location="其它附件"
:attachment-location-options="changeAttachmentLocationOptions"
:rows="attachments"
:preview="previewAttachment"
@update:rows="attachments = $event"
@upload-to-location="handleAttachmentUploadToLocation"
/>
<section class="change-section change-reason-section">
@@ -281,11 +283,12 @@
title="变更材料"
description
attachment-type
use-upload-dialog
attachment-location="变更材料"
:attachment-location-options="changeAttachmentLocationOptions"
:rows="changeMaterials"
:preview="previewAttachment"
@update:rows="changeMaterials = $event"
@upload-to-location="handleAttachmentUploadToLocation"
/>
<div class="page-footer">
<el-button @click="$router.back()">取消</el-button>
@@ -302,6 +305,7 @@
<script>
import * as api from '@/api/business/contract-manage';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
import BillingPlanEditor from './components/billing-plan-editor.vue';
import ContractAttachmentSection, {
normalizeContractFileRows,
@@ -342,7 +346,15 @@ const normalizeOptionalPositiveInteger = value => {
return Number.isInteger(number) && number > 0 ? number : null;
};
const normalizeOptionalAmount = value => {
if (value === undefined || value === null || value === '') return null;
if (
value === undefined ||
value === null ||
value === '' ||
Number(value) === -1 ||
String(value) === '-1'
) {
return null;
}
const number = Number(value);
return Number.isFinite(number) && number >= 0 ? Number(number.toFixed(2)) : null;
};
@@ -420,6 +432,22 @@ export default {
pageTitle() {
return this.$route.query.name || '合同变更';
},
changeAttachmentLocationOptions() {
return ['合同文件', '其它附件', '变更材料'];
},
contractAmountDisplay() {
const value = this.form.contractAmount;
if (
value === undefined ||
value === null ||
value === '' ||
Number(value) === -1 ||
String(value) === '-1'
) {
return '';
}
return value;
},
contractCategoryOptions() {
return this.contractCategoryDictOptions.length
? this.contractCategoryDictOptions
@@ -463,6 +491,13 @@ export default {
},
},
methods: {
handleContractAmountInput(value) {
const text = String(value || '').replace(/[^\d.]/g, '');
const parts = text.split('.');
const normalized =
parts.length > 1 ? `${parts[0]}.${parts.slice(1).join('').slice(0, 2)}` : parts[0];
this.form.contractAmount = normalized === '' ? null : normalized;
},
loadDictionaries() {
Promise.all([
getSystemDictionary({ code: 'currency_type' }),
@@ -618,6 +653,20 @@ export default {
attachmentExtension(row = {}) { const source = String(this.attachmentName(row) || this.attachmentUrl(row)).split('?')[0]; const index = source.lastIndexOf('.'); return index > -1 ? source.slice(index + 1).toLowerCase() : ''; },
isAttachmentImage(row) { return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'].includes(this.attachmentExtension(row)); },
previewAttachment(row, rows = this.attachments) { const url = this.attachmentUrl(row); if (!url) { this.$message.warning('附件地址为空,无法预览'); return; } if (this.isAttachmentImage(row)) { this.imagePreviewUrls = (rows || []).filter(item => this.isAttachmentImage(item) && this.attachmentUrl(item)).map(item => this.attachmentUrl(item)); this.imagePreviewIndex = Math.max(this.imagePreviewUrls.indexOf(url), 0); this.imagePreviewVisible = true; return; } this.previewFile = { name: this.attachmentName(row), url, mimeType: row.mimeType || row.contentType || '' }; this.documentPreviewVisible = true; },
handleAttachmentUploadToLocation({ location, rows = [] }) {
if (!rows.length) return;
if (location === '合同文件') {
this.contractFileRows = [...(this.contractFileRows || []), ...rows];
return;
}
if (location === '其它附件') {
this.attachments = [...(this.attachments || []), ...rows];
return;
}
if (location === '变更材料') {
this.changeMaterials = [...(this.changeMaterials || []), ...rows];
}
},
handlePreviewUnsupported() { this.$message.warning('当前文件暂不支持在线预览'); },
handlePreviewError() { this.$message.error('附件预览失败'); },
formatFileSize(value) { const size = Number(value || 0); return size > 1024 * 1024 ? `${(size / 1024 / 1024).toFixed(2)}MB` : `${Math.max(1, Math.ceil(size / 1024))}KB`; },
@@ -628,8 +677,8 @@ export default {
addCustomPeriodRow() { const periods = normalizeCustomPeriods(this.settlementRule.customPeriods || []); periods.push({ startDay: '', endDay: '' }); this.settlementRule.customPeriods = periods; },
removeCustomPeriodRow(index) { if (index <= 0) return; const periods = [...(this.settlementRule.customPeriods || [])]; periods.splice(index, 1); this.settlementRule.customPeriods = normalizeCustomPeriods(periods); },
validateCustomPeriods(periods = [], label) { const rows = normalizeCustomPeriods(periods); if (!rows.length) { this.$message.warning(`${label}:请至少配置一段自定义周期`); return false; } for (let index = 0; index < rows.length; index += 1) { const row = rows[index]; const startDay = Number(row.startDay); const endDay = Number(row.endDay); if (!Number.isFinite(startDay) || startDay < 1 || startDay > 31) { this.$message.warning(`${label}:请选择第${index + 1}行运单区间开始日`); return false; } if (!Number.isFinite(endDay) || endDay < 1 || endDay > 31) { this.$message.warning(`${label}:请选择第${index + 1}行运单区间结束日`); return false; } if (endDay < startDay) { this.$message.warning(`${label}:第${index + 1}行结束日不能早于开始日`); return false; } if (index > 0 && startDay !== Number(rows[index - 1].endDay) + 1) { this.$message.warning(`${label}:自定义多周期区间必须连续,不允许重叠或存在日期缺口`); return false; } } return true; },
validateSettlementRule(rule, label) { if (Number(rule.autoGenerate) !== 1) return true; if (!rule.billStartDate || !rule.settlementType) { this.$message.warning(`${label}:请完整填写账单起始日期和结算类型`); return false; } if (rule.settlementType === '月结' && !rule.billCycleType) { this.$message.warning(`${label}:请选择结算周期`); return false; } if (rule.settlementType === '月结' && rule.billCycleType === '固定截单日' && !rule.billCutoffDay) { this.$message.warning(`${label}:请选择账单截单日`); return false; } if (rule.settlementType === '月结' && rule.billCycleType === '自定义多周期') return this.validateCustomPeriods(rule.customPeriods, label); if (rule.settlementType === '固定天数周期结算' && !rule.cycleDays) { this.$message.warning(`${label}:请选择周期天数`); return false; } return true; },
async submit() { await this.$refs.formRef.validate(); const total = this.paymentRatioRows.reduce((sum, row) => sum + Number(row.ratioLimit || 0), 0); if (this.paymentRatioRows.length && Math.abs(total - 100) > 0.0001) { this.$message.warning('付款比例上限合计必须等于100%'); return; } if (this.settlementConfigTab === 'pre') this.preSettlementConfig = { ...this.settlementRule }; else this.formalSettlementConfig = { ...this.settlementRule }; if (!this.validateSettlementRule(this.preSettlementConfig, '预结算配置') || !this.validateSettlementRule(this.formalSettlementConfig, '正式结算配置')) return; const settlementRule = { preSettlementConfig: this.preSettlementConfig, formalSettlementConfig: this.formalSettlementConfig }; await api.submitChange({ ...this.form, settlementCurrency: String(this.form.settlementCurrency || '').trim() || 'RMB', copyCount: normalizeOptionalPositiveInteger(this.form.copyCount), invoiceCycle: normalizeOptionalPositiveInteger(this.form.invoiceCycle), paymentDays: normalizeOptionalPositiveInteger(this.form.paymentDays), contractAmount: normalizeOptionalAmount(this.form.contractAmount), startDate: this.period[0], endDate: this.period[1], feeGenerationMode: this.feeGenerationMode, billingEnabled: this.feeGenerationMode === 'system' ? 1 : 0, billingPlanJson: JSON.stringify(this.plans), settlementRuleJson: JSON.stringify(settlementRule), preSettlementConfigJson: JSON.stringify(this.preSettlementConfig), formalSettlementConfigJson: JSON.stringify(this.formalSettlementConfig), paymentRatioJson: JSON.stringify(this.paymentRatioRows), contractFileJson: JSON.stringify(this.contractFileRows), attachmentsJson: JSON.stringify(this.attachments), changeContent: this.form.changeContent, changeReason: this.form.changeReason, changeAttachmentsJson: JSON.stringify(this.changeMaterials) }); this.$message.success('变更已提交'); this.$router.back(); },
validateSettlementRule(rule, label) { if (Number(rule.autoGenerate) !== 1) return true; if (!rule.billStartDate || !rule.settlementType) { this.$message.warning(`${label}:请完整填写账单起始日和结算类型`); return false; } if (rule.settlementType === '月结' && !rule.billCycleType) { this.$message.warning(`${label}:请选择结算周期`); return false; } if (rule.settlementType === '月结' && rule.billCycleType === '固定截单日' && !rule.billCutoffDay) { this.$message.warning(`${label}:请选择账单截单日`); return false; } if (rule.settlementType === '月结' && rule.billCycleType === '自定义多周期') return this.validateCustomPeriods(rule.customPeriods, label); if (rule.settlementType === '固定天数周期结算' && !rule.cycleDays) { this.$message.warning(`${label}:请选择周期天数`); return false; } return true; },
async submit() { await this.$refs.formRef.validate(); const total = this.paymentRatioRows.reduce((sum, row) => sum + Number(row.ratioLimit || 0), 0); if (this.paymentRatioRows.length && Math.abs(total - 100) > 0.0001) { this.$message.warning('付款比例上限合计必须等于100%'); return; } if (this.settlementConfigTab === 'pre') this.preSettlementConfig = { ...this.settlementRule }; else this.formalSettlementConfig = { ...this.settlementRule }; if (!this.validateSettlementRule(this.preSettlementConfig, '预结算配置') || !this.validateSettlementRule(this.formalSettlementConfig, '正式结算配置')) return; const settlementRule = { preSettlementConfig: this.preSettlementConfig, formalSettlementConfig: this.formalSettlementConfig }; await api.submitChange({ ...this.form, settlementCurrency: String(this.form.settlementCurrency || '').trim() || 'RMB', copyCount: normalizeOptionalPositiveInteger(this.form.copyCount), invoiceCycle: normalizeOptionalPositiveInteger(this.form.invoiceCycle), paymentDays: normalizeOptionalPositiveInteger(this.form.paymentDays), contractAmount: normalizeOptionalAmount(this.form.contractAmount), startDate: this.period[0], endDate: this.period[1], feeGenerationMode: this.feeGenerationMode, billingEnabled: this.feeGenerationMode === 'system' ? 1 : 0, billingPlanJson: JSON.stringify(this.plans), settlementRuleJson: JSON.stringify(settlementRule), preSettlementConfigJson: JSON.stringify(this.preSettlementConfig), formalSettlementConfigJson: JSON.stringify(this.formalSettlementConfig), paymentRatioJson: JSON.stringify(this.paymentRatioRows), contractFileJson: JSON.stringify(this.contractFileRows), attachmentsJson: JSON.stringify(this.attachments), changeContent: this.form.changeContent, changeReason: this.form.changeReason, changeAttachmentsJson: JSON.stringify(this.changeMaterials) }); await submitMkApprovalFlow({ bizType: 'contract-manage', formInstanceId: this.form.id, subjectName: this.form.contractName || '', approvalStatus: this.form.approvalStatus || 'change_rejected' }); this.$message.success('变更已提交'); this.$router.back(); },
},
};
</script>
@@ -653,6 +702,14 @@ export default {
.contract-basic-section :deep(.el-input),
.contract-basic-section :deep(.el-select),
.contract-basic-section :deep(.el-date-editor) { width: 360px; max-width: 100%; }
.contract-basic-section :deep(.el-input-number) {
width: 360px;
max-width: 100%;
.el-input__inner {
text-align: left;
}
}
.dialog-section-title { margin-bottom: 18px; font-size: 16px; font-weight: 600; }
.dialog-section-title::before { display: inline-block; width: 4px; height: 16px; margin-right: 8px; vertical-align: -2px; background: #409eff; content: ''; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
@@ -0,0 +1,21 @@
<template>
<mk-public-shell biz-type="contract-manage" :get-form="getForm">
<contract-manage ref="page" />
</mk-public-shell>
</template>
<script>
import MkPublicShell from '@/views/mk/mk-public-shell.vue';
import ContractManage from '@/views/business/contract-manage.vue';
export default {
name: 'ContractManagePublicView',
components: { MkPublicShell, ContractManage },
methods: {
getForm() {
const row = this.$refs.page?.detailRow || {};
return { ...row, subject: row.contractName || row.contractNo || '' };
},
},
};
</script>
+249 -113
View File
@@ -222,7 +222,7 @@
Number(detailSettlementRule.autoGenerate) === 1 ? '开启' : '关闭'
}}</el-descriptions-item>
<template v-if="Number(detailSettlementRule.autoGenerate) === 1">
<el-descriptions-item label="账单起始日期">{{
<el-descriptions-item label="账单起始日">{{
displayValue(detailSettlementRule.billStartDate)
}}</el-descriptions-item>
<el-descriptions-item label="结算类型">{{
@@ -244,7 +244,7 @@
}}</el-descriptions-item
>
<el-descriptions-item
v-if="detailSettlementRule.settlementType === '固定天数周期结算'"
v-if="isFixedCycleSettlementType(detailSettlementRule.settlementType)"
label="周期天数"
>{{
detailObjectUnitValue(detailSettlementRule, 'cycleDays', '天')
@@ -345,7 +345,7 @@
</section>
</div>
<div class="contract-manage-page__footer">
<el-button @click="closeDetail">关闭</el-button>
<el-button v-if="!isPublicViewPage" @click="closeDetail">关闭</el-button>
</div>
</template>
@@ -478,7 +478,7 @@
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="YYYY-MM-DD"
placeholder="请输入"
/>
<span>至</span>
<el-date-picker
@@ -486,7 +486,7 @@
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="YYYY-MM-DD"
placeholder="请输入"
/>
</div>
</el-form-item>
@@ -498,12 +498,12 @@
><template #suffix>天</template></el-input>
</el-form-item>
<el-form-item label="合同金额">
<el-input-number
v-model="form.contractAmount"
:min="0"
:precision="2"
:controls="false"
<el-input
:model-value="contractAmountDisplay"
placeholder="请输入"
clearable
@input="handleContractAmountInput"
@clear="form.contractAmount = null"
/>
</el-form-item>
<el-form-item label="是否范本">
@@ -592,12 +592,13 @@
title="合同文件"
description
attachment-type
use-upload-dialog
:attachment-location-options="contractAttachmentLocationOptions"
:lock-approved="isAttachmentUploadMode || hasApprovedContractFiles"
:mark-approved-on-upload="isAttachmentUploadMode"
:rows="contractFileRows"
:preview="previewAttachment"
@update:rows="contractFileRows = $event"
@upload-to-location="handleAttachmentUploadToLocation"
/>
<section class="contract-manage-form__section contract-manage-form__section--panel">
@@ -646,7 +647,7 @@
content="开启时,系统根据配置规则归集运单,定时生成结算单"
placement="top"
>
<el-icon class="settlement-switch-tip"><QuestionFilled /></el-icon>
<el-icon class="contract-manage-form__fee-mode-tip"><QuestionFilled /></el-icon>
</el-tooltip>
<el-radio :label="0">关闭</el-radio>
</el-radio-group>
@@ -655,13 +656,13 @@
v-if="settlementRuleEnabled"
class="contract-manage-form__grid contract-manage-form__settlement-grid"
>
<el-form-item label="账单起始日期" required>
<el-form-item label="账单起始日" required>
<el-date-picker
v-model="settlementRuleForm.billStartDate"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="请选择账单起始日期"
placeholder="请选择账单起始日"
/>
</el-form-item>
<el-form-item label="结算类型" required>
@@ -811,12 +812,13 @@
title="其它附件"
description
attachment-type
use-upload-dialog
attachment-location="其它附件"
:attachment-location-options="contractAttachmentLocationOptions"
:readonly="isAttachmentUploadMode"
:rows="attachmentRows"
:preview="previewAttachment"
@update:rows="attachmentRows = $event"
@upload-to-location="handleAttachmentUploadToLocation"
/>
<section
@@ -921,6 +923,21 @@
@save="saveBillingPlan"
/>
<contract-attachment-section
ref="listAttachmentUploader"
dialog-only
title="合同文件"
description
attachment-type
use-upload-dialog
mark-approved-on-upload
:attachment-location-options="['合同文件', '其它附件']"
:rows="listUploadContractFileRows"
@update:rows="listUploadContractFileRows = $event"
@upload-to-location="handleListAttachmentUploadToLocation"
@upload-confirmed="handleListAttachmentUploadConfirmed"
/>
<el-dialog
v-model="attachmentDocumentPreviewVisible"
:title="attachmentPreviewFile.name || '附件预览'"
@@ -962,44 +979,10 @@
@close="attachmentImagePreviewVisible = false"
/>
<el-dialog
<change-record-detail-dialog
v-model="detailChangeRecordVisible"
title="变更记录详情"
append-to-body
destroy-on-close
width="1100px"
top="10px"
class="contract-change-record-detail-dialog"
>
<div v-if="detailChangeRecord" class="contract-change-record-detail-meta">
<span>经办人:{{ detailChangeRecord.handlerUserName || '-' }}</span>
<span>变更类型:{{ detailChangeRecord.changeType || '-' }}</span>
<span>状态:{{ detailChangeRecord.statusName || detailChangeRecord.status || '-' }}</span>
</div>
<el-table :data="detailChangeRecordDetailRows" border :show-overflow-tooltip="false">
<el-table-column prop="field" label="变更字段" min-width="180" />
<el-table-column
prop="before"
label="变更前"
min-width="360"
class-name="contract-change-record-detail-value"
/>
<el-table-column
prop="after"
label="变更后"
min-width="500"
class-name="contract-change-record-detail-value"
/>
</el-table>
<el-empty
v-if="!detailChangeRecordDetailRows.length"
description="暂无变更内容"
:image-size="60"
/>
<template #footer>
<el-button type="primary" @click="detailChangeRecordVisible = false">关闭</el-button>
</template>
</el-dialog>
:rows="detailChangeRecordDetailRows"
/>
<billing-plan-editor
v-model="detailBillingPlanBox"
@@ -1027,6 +1010,7 @@ import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import { exportBlob } from '@/api/common';
import * as api from '@/api/business/contract-manage';
import { getMkPublicDetail } from '@/api/mk-process';
import { getList as getProjectList } from '@/api/business/project-apply';
import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive';
import { getDeptTree } from '@/api/system/dept';
@@ -1035,7 +1019,9 @@ import { getDictionary as getBizDictionary } from '@/api/system/dictbiz';
import { config, option } from '@/option/business/contract-manage';
import { getToken } from '@/utils/auth';
import { downloadFileByUrl, downloadXls } from '@/utils/util';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
import BillingPlanEditor from './components/billing-plan-editor.vue';
import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue';
import ContractAttachmentSection, {
attachmentName as sharedAttachmentName,
attachmentUrl as sharedAttachmentUrl,
@@ -1057,7 +1043,15 @@ const normalizeOptionalInteger = (value, emptyValue = null) => {
return Number.isFinite(number) ? Math.trunc(number) : emptyValue;
};
const normalizeOptionalAmount = (value, emptyValue = null) => {
if (value === undefined || value === null || value === '') return emptyValue;
if (
value === undefined ||
value === null ||
value === '' ||
Number(value) === -1 ||
String(value) === '-1'
) {
return emptyValue;
}
const number = Number(value);
return Number.isFinite(number) && number >= 0 ? Number(number.toFixed(2)) : emptyValue;
};
@@ -1099,7 +1093,7 @@ const defaultForm = () => ({
settlementCurrency: '',
invoiceCycle: '',
paymentDays: '',
contractAmount: '',
contractAmount: null,
templateFlag: 0,
originalContractNo: '',
electronicSealFlag: 0,
@@ -1180,7 +1174,14 @@ const attachmentViewerPlugins = [
export default {
name: 'ContractManage',
components: { ContractAttachmentSection, BillingPlanEditor, ElImageViewer, OpenFileViewer, PdfPreview },
components: {
ContractAttachmentSection,
BillingPlanEditor,
ChangeRecordDetailDialog,
ElImageViewer,
OpenFileViewer,
PdfPreview,
},
data() {
return {
api,
@@ -1248,6 +1249,9 @@ export default {
organizationLoading: false,
contractFileRows: [],
attachmentRows: [],
listUploadContractFileRows: [],
listUploadAttachmentRows: [],
attachmentUploadFromList: false,
attachmentImagePreviewVisible: false,
attachmentImagePreviewUrls: [],
attachmentImagePreviewIndex: 0,
@@ -1271,7 +1275,7 @@ export default {
formalSettlementRuleForm: defaultSettlementRule(),
paymentRatioRows: [],
changeRecordRows: [],
settlementTypeOptions: ['月结', '日结', '周结', '半月结', '固定天数周期结算'],
settlementTypeOptions: ['现结', '日结', '周结', '月结', '按固定天数周期'],
billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'],
detailLoading: false,
detailRow: {},
@@ -1315,7 +1319,12 @@ export default {
return this.$route.path === '/business/contract-manage/form';
},
isDetailPage() {
return this.$route.path === '/business/contract-manage/detail';
return (
this.$route.path === '/business/contract-manage/detail' || this.isPublicViewPage
);
},
isPublicViewPage() {
return this.$route.path === '/business/contract-manage/public-view';
},
formMode() {
return this.$route.query.mode === 'edit' ? 'edit' : 'add';
@@ -1330,6 +1339,23 @@ export default {
isAttachmentUploadMode() {
return this.$route.query.attachmentUpload === '1';
},
contractAttachmentLocationOptions() {
if (this.isAttachmentUploadMode) return ['合同文件'];
return ['合同文件', '其它附件'];
},
contractAmountDisplay() {
const value = this.form.contractAmount;
if (
value === undefined ||
value === null ||
value === '' ||
Number(value) === -1 ||
String(value) === '-1'
) {
return '';
}
return value;
},
hasApprovedContractFiles() {
return (this.contractFileRows || []).some(
row =>
@@ -1411,7 +1437,7 @@ export default {
return this.showBillCycleType && this.settlementRuleForm.billCycleType === '自定义多周期';
},
showCycleDays() {
return this.settlementRuleForm.settlementType === '固定天数周期结算';
return this.isFixedCycleSettlementType(this.settlementRuleForm.settlementType);
},
billCutoffDayOptions() {
return Array.from({ length: 31 }, (_, index) => ({
@@ -1472,9 +1498,11 @@ export default {
},
},
created() {
this.loadProjectOptions();
this.loadSettlementDictionaries();
this.loadOrganizationOptions();
if (!this.isPublicViewPage) {
this.loadProjectOptions();
this.loadSettlementDictionaries();
this.loadOrganizationOptions();
}
if (this.isFormPage) this.initFormPage();
if (this.isDetailPage) this.initDetailPage();
},
@@ -1674,7 +1702,7 @@ export default {
copyCount: normalizeOptionalInteger(detail.copyCount, ''),
invoiceCycle: normalizeOptionalInteger(detail.invoiceCycle, ''),
paymentDays: normalizeOptionalInteger(detail.paymentDays, ''),
contractAmount: normalizeOptionalAmount(detail.contractAmount, ''),
contractAmount: normalizeOptionalAmount(detail.contractAmount, null),
archiveStatus: detail.archiveStatus || '未归档',
feeGenerationMode:
detail.feeGenerationMode || (Number(detail.billingEnabled) === 0 ? 'manual' : 'system'),
@@ -1824,9 +1852,17 @@ export default {
const id = saved.id || this.form.id;
if (action === 'temporary' || action === 'formal') {
if (!id) throw new Error('合同保存成功但未返回主键,无法提交合同');
return action === 'temporary'
return (action === 'temporary'
? this.api.toTemporary(id)
: this.api.submitFormal(id);
: this.api.submitFormal(id)
).then(() =>
submitMkApprovalFlow({
bizType: 'contract-manage',
formInstanceId: id,
subjectName: saved.contractName || submit.contractName || '',
approvalStatus: saved.approvalStatus || submit.approvalStatus || '',
})
);
}
return null;
})
@@ -1853,8 +1889,20 @@ export default {
: this.api.submit(payload);
request
.then(() => {
this.$message.success(isChangeRejected ? '已重新提交变更审批' : '修改成功');
this.closeForm();
if (!isChangeRejected) {
this.$message.success('修改成功');
this.closeForm();
return;
}
return submitMkApprovalFlow({
bizType: 'contract-manage',
formInstanceId: payload.id || this.form.id,
subjectName: payload.contractName || this.form.contractName || '',
approvalStatus: this.form.approvalStatus || 'change_rejected',
}).then(() => {
this.$message.success('已重新提交变更审批');
this.closeForm();
});
})
.finally(() => {
this.submitAction = '';
@@ -1867,20 +1915,86 @@ export default {
return;
}
this.submitAction = 'attachment';
this.api
const contractFileRows = this.attachmentUploadFromList
? this.listUploadContractFileRows
: this.contractFileRows;
const attachmentRows = this.attachmentUploadFromList
? this.listUploadAttachmentRows
: this.attachmentRows;
return this.api
.updateAttachments({
id: this.form.id,
contractFileJson: JSON.stringify(this.contractFileRows),
attachmentsJson: JSON.stringify(this.attachmentRows),
contractFileJson: JSON.stringify(contractFileRows),
attachmentsJson: JSON.stringify(attachmentRows),
})
.then(() => {
this.$message.success('附件保存成功');
if (this.attachmentUploadFromList) {
this.attachmentUploadFromList = false;
this.listUploadContractFileRows = [];
this.listUploadAttachmentRows = [];
this.onLoad(this.page, this.query);
return;
}
this.closeForm();
})
.finally(() => {
this.submitAction = '';
});
},
openAttachmentUploadDialog(row = {}) {
if (!row?.id) {
this.$message.warning('合同不存在,无法上传附件');
return;
}
const loading = this.$loading({
lock: true,
text: '加载中',
background: 'rgba(255, 255, 255, 0.6)',
});
this.attachmentUploadFromList = true;
this.listUploadContractFileRows = [];
this.listUploadAttachmentRows = [];
this.form = { ...defaultForm(), id: row.id };
this.api
.getDetail(row.id)
.then(res => {
const detail = res.data?.data || {};
this.form = {
...defaultForm(),
...detail,
id: detail.id || row.id,
};
this.listUploadContractFileRows = normalizeContractFileRows(
parseArray(detail.contractFileJson)
);
this.listUploadAttachmentRows = parseArray(detail.attachmentsJson);
this.$nextTick(() => {
this.$refs.listAttachmentUploader?.openUploadDialog?.();
});
})
.catch(() => {
this.attachmentUploadFromList = false;
this.$message.error('合同详情加载失败');
})
.finally(() => {
loading.close();
});
},
handleListAttachmentUploadConfirmed() {
if (!this.attachmentUploadFromList) return;
this.submitAttachmentUpload();
},
handleListAttachmentUploadToLocation({ location, rows = [] }) {
if (!rows.length) return;
if (location === '合同文件') {
this.listUploadContractFileRows = [...(this.listUploadContractFileRows || []), ...rows];
return;
}
if (location === '其它附件') {
this.listUploadAttachmentRows = [...(this.listUploadAttachmentRows || []), ...rows];
}
},
loadProjectOptions() {
if (this.projectLoading) return;
this.projectLoading = true;
@@ -2097,6 +2211,13 @@ export default {
integerInput(prop, value) {
this.form[prop] = String(value || '').replace(/\D/g, '');
},
handleContractAmountInput(value) {
const text = String(value || '').replace(/[^\d.]/g, '');
const parts = text.split('.');
const normalized =
parts.length > 1 ? `${parts[0]}.${parts.slice(1).join('').slice(0, 2)}` : parts[0];
this.form.contractAmount = normalized === '' ? null : normalized;
},
positiveIntegerInput(prop, value) {
const normalized = String(value || '').replace(/\D/g, '').replace(/^0+/, '');
this.form[prop] = normalized;
@@ -2127,6 +2248,16 @@ export default {
};
this.attachmentDocumentPreviewVisible = true;
},
handleAttachmentUploadToLocation({ location, rows = [] }) {
if (!rows.length) return;
if (location === '合同文件') {
this.contractFileRows = [...(this.contractFileRows || []), ...rows];
return;
}
if (location === '其它附件') {
this.attachmentRows = [...(this.attachmentRows || []), ...rows];
}
},
handleAttachmentPreviewUnsupported() {
this.$message.warning('当前文件暂不支持在线预览');
},
@@ -2185,8 +2316,12 @@ export default {
}
return true;
},
isFixedCycleSettlementType(value) {
return value === '按固定天数周期' || value === '固定天数周期结算';
},
normalizeSettlementRule(rule = {}) {
const next = { ...defaultSettlementRule(), ...rule };
if (next.settlementType === '固定天数周期结算') next.settlementType = '按固定天数周期';
if (next.settlementType !== '月结') {
next.billCycleType = '';
next.billCutoffDay = '';
@@ -2201,7 +2336,7 @@ export default {
} else {
next.customPeriods = [];
}
if (next.settlementType !== '固定天数周期结算') next.cycleDays = '';
if (!this.isFixedCycleSettlementType(next.settlementType)) next.cycleDays = '';
return next;
},
syncSettlementConfig() {
@@ -2224,7 +2359,7 @@ export default {
this.settlementRuleForm.billCycleType = '';
this.settlementRuleForm.billCutoffDay = '';
this.settlementRuleForm.customPeriods = [];
if (value !== '固定天数周期结算') this.settlementRuleForm.cycleDays = '';
if (!this.isFixedCycleSettlementType(value)) this.settlementRuleForm.cycleDays = '';
},
handleBillCycleTypeChange(value) {
if (value !== '固定截单日') this.settlementRuleForm.billCutoffDay = '';
@@ -2315,7 +2450,7 @@ export default {
validateSettlementRule(rule, label) {
if (Number(rule.autoGenerate) !== 1) return true;
if (!rule.billStartDate || !rule.settlementType) {
this.$message.warning(`${label}:请完整填写账单起始日期和结算类型`);
this.$message.warning(`${label}:请完整填写账单起始日和结算类型`);
return false;
}
if (rule.settlementType === '月结' && !rule.billCycleType) {
@@ -2333,7 +2468,7 @@ export default {
if (rule.settlementType === '月结' && rule.billCycleType === '自定义多周期') {
return this.validateCustomPeriods(rule.customPeriods, label);
}
if (rule.settlementType === '固定天数周期结算' && !rule.cycleDays) {
if (this.isFixedCycleSettlementType(rule.settlementType) && !rule.cycleDays) {
this.$message.warning(`${label}:请选择周期天数`);
return false;
}
@@ -2385,8 +2520,10 @@ export default {
if (!id) return;
this.detailLoading = true;
this.applyDetailState({});
this.api
.getDetail(id)
const request = this.isPublicViewPage
? getMkPublicDetail('contract-manage', id)
: this.api.getDetail(id);
request
.then(res => {
this.applyDetailState(res.data?.data || {});
})
@@ -2555,7 +2692,7 @@ export default {
.join(',')}`
);
}
if (config.billStartDate) parts.push(`账单起始日期:${config.billStartDate}`);
if (config.billStartDate) parts.push(`账单起始日:${config.billStartDate}`);
return parts.join(',');
};
if (normalized.preSettlementConfig || normalized.formalSettlementConfig) {
@@ -2651,6 +2788,15 @@ export default {
},
detailValue(prop) {
const value = this.detailRow[prop];
if (prop === 'contractAmount') {
return value === undefined ||
value === null ||
value === '' ||
Number(value) === -1 ||
String(value) === '-1'
? '-'
: value;
}
if (
prop === 'contractStage' ||
prop === 'approvalStatus' ||
@@ -2685,20 +2831,24 @@ export default {
return;
}
if (operation.action === 'attachmentUpload') {
this.$router.push({
path: '/business/contract-manage/form',
query: {
mode: 'edit',
id: row.id,
name: '附件上传',
attachmentUpload: '1',
},
});
this.openAttachmentUploadDialog(row);
return;
}
const run = value => {
const args = operation.prompt ? [row.id, value] : [row.id];
this.api[operation.action](...args).then(() => {
const request = () => this.api[operation.action](...args);
const afterMk =
operation.action === 'submitFormal'
? request().then(() =>
submitMkApprovalFlow({
bizType: 'contract-manage',
formInstanceId: row.id,
subjectName: row.contractName || '',
approvalStatus: row.approvalStatus || '',
})
)
: request();
afterMk.then(() => {
this.$message.success(operation.successMessage || `${operation.label}成功`);
this.onLoad(this.page, this.query);
});
@@ -2867,25 +3017,6 @@ export default {
word-break: break-word;
}
.contract-change-record-detail-meta {
display: flex;
flex-wrap: wrap;
gap: 8px 32px;
margin-bottom: 16px;
color: #606266;
}
:deep(.contract-change-record-detail-dialog .el-dialog__body) {
max-height: 65vh;
overflow: auto;
padding-top: 12px;
}
:deep(.contract-change-record-detail-dialog .contract-change-record-detail-value .cell) {
white-space: pre-wrap;
word-break: break-all;
}
:global(.avue--collapse .contract-manage-page__footer) {
left: 60px;
}
@@ -2921,6 +3052,10 @@ export default {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
&--attachment {
overflow: visible;
}
> .dialog-section-title,
:deep(.dialog-section-title) {
margin-bottom: 20px;
@@ -2985,13 +3120,6 @@ export default {
align-items: center;
gap: 20px;
margin-bottom: 16px;
.settlement-switch-tip {
margin: 0 4px;
color: #a8abb2;
cursor: help;
font-size: 14px;
}
}
&__settlement-grid {
@@ -3049,11 +3177,19 @@ export default {
min-width: 0;
}
:deep(.el-input-number) {
width: 360px;
max-width: 100%;
.el-input__inner {
text-align: left;
}
}
:deep(.el-input),
:deep(.el-select),
:deep(.el-cascader),
:deep(.el-tree-select),
:deep(.el-input-number),
:deep(.el-date-editor) {
width: 360px;
max-width: 100%;
File diff suppressed because it is too large Load Diff
+225 -111
View File
@@ -1,57 +1,58 @@
<template>
<basic-container class="master-order-page">
<template v-if="mode === 'list'">
<el-form :model="query" class="master-search" label-width="160px" @submit.prevent>
<el-row :gutter="16">
<el-col v-for="field in primaryFields" :key="field.prop" :span="6"
><el-form-item :label="field.label"
><el-input v-model="query[field.prop]" placeholder="请输入" /></el-form-item
></el-col>
<el-col :span="6"
><el-form-item label="状态"
><el-select v-model="query.businessStatus" placeholder="全部"
><el-option label="全部" value="" /><el-option
<div class="master-order-page__search">
<el-form :model="query" label-position="right" label-width="88px" @submit.prevent>
<div class="master-order-page__search-grid">
<el-form-item v-for="field in primaryFields" :key="field.prop" :label="field.label">
<el-input v-model="query[field.prop]" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="状态">
<el-select v-model="query.businessStatus" clearable placeholder="全部">
<el-option label="全部" value="" />
<el-option
v-for="item in statuses"
:key="item.value"
:label="item.label"
:value="item.value" /></el-select></el-form-item
></el-col>
<template v-if="searchExpanded">
<el-col v-for="field in secondaryFields" :key="field.prop" :span="6"
><el-form-item :label="field.label"
><el-input v-model="query[field.prop]" placeholder="请输入" /></el-form-item
></el-col>
<el-col :span="6"
><el-form-item label="计划开始日期"
><el-date-picker
:value="item.value"
/>
</el-select>
</el-form-item>
<template v-if="searchExpanded">
<el-form-item v-for="field in secondaryFields" :key="field.prop" :label="field.label">
<el-input v-model="query[field.prop]" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="计划开始日期">
<el-date-picker
v-model="query.planStartRange"
type="datetimerange"
format="YYYY-MM-DD HH:mm"
value-format="YYYY-MM-DD HH:mm:ss"
start-placeholder="请选择"
end-placeholder="请选择" /></el-form-item
></el-col>
<el-col :span="6"
><el-form-item label="计划结束日期"
><el-date-picker
end-placeholder="请选择"
/>
</el-form-item>
<el-form-item label="计划结束日期">
<el-date-picker
v-model="query.planEndRange"
type="datetimerange"
format="YYYY-MM-DD HH:mm"
value-format="YYYY-MM-DD HH:mm:ss"
start-placeholder="请选择"
end-placeholder="请选择" /></el-form-item
></el-col>
</template>
<el-col :span="24" class="search-actions"
><el-button type="primary" @click="search">查询</el-button
><el-button @click="reset">重置</el-button
><el-link type="primary" @click="searchExpanded = !searchExpanded"
><el-icon><component :is="searchExpanded ? ArrowUp : ArrowDown" /></el-icon
>{{ searchExpanded ? '折叠' : '展开' }}</el-link
></el-col
>
</el-row>
</el-form>
end-placeholder="请选择"
/>
</el-form-item>
</template>
<div class="master-order-page__search-actions">
<el-button type="primary" @click="search">查询</el-button>
<el-button @click="reset">重置</el-button>
<el-link type="primary" @click="searchExpanded = !searchExpanded">{{
searchExpanded ? '收起' : '展开'
}}</el-link>
</div>
</div>
</el-form>
</div>
<section class="master-list-panel">
<div class="toolbar">
<el-button type="primary" @click="goCreate()">新建多联总单</el-button
@@ -76,7 +77,13 @@
<div class="route-point">
<span :class="['route-node', node.type]">{{ node.text }}</span>
<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>
</div>
</div>
@@ -125,7 +132,7 @@
/>
</template>
<master-order-dispatch v-else-if="mode === 'dispatch'" :id="routeId" @back="goList" />
<master-order-detail v-else :id="routeId" @back="goList" />
<master-order-detail v-else-if="mode === 'detail'" :id="routeId" />
<el-dialog v-model="confirm.visible" title="提示" width="400px"
><span>{{ confirm.message }}</span
><template #footer
@@ -138,7 +145,6 @@
<script>
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 MasterOrderDispatch from './components/master-order-dispatch.vue';
import MasterOrderDetail from './components/master-order-detail.vue';
@@ -147,8 +153,10 @@ export default {
components: { MasterOrderEditor, MasterOrderDispatch, MasterOrderDetail },
data() {
return {
ArrowDown,
ArrowUp,
// 实例创建时锁定所属路由。keep-alive 缓存后 $route 会变成其它页面,
// 不能再用全局 query.mode / query.id 决定本页形态,否则打开「新增项目管理」
//(mode=add 且无 id)会落入详情分支并请求缺少 id 的详情接口。
routePathLocked: this.$route.path,
searchExpanded: false,
loading: false,
records: [],
@@ -176,10 +184,15 @@ export default {
};
},
computed: {
isOwnedRoute() {
return this.$route.path === this.routePathLocked;
},
mode() {
if (!this.isOwnedRoute) return 'list';
return this.$route.query.mode || 'list';
},
routeId() {
if (!this.isOwnedRoute) return '';
return this.$route.query.id;
},
masterEditorTitle() {
@@ -190,6 +203,7 @@ export default {
'$route.query': {
immediate: true,
handler() {
if (!this.isOwnedRoute) return;
this.syncTagTitle();
if (this.mode === 'list') this.load();
},
@@ -303,7 +317,7 @@ export default {
},
timeRange(row) {
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) {
@@ -334,6 +348,19 @@ export default {
const value = String(type || '').trim().toLowerCase();
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) {
const text = String(value || '').replace(/\s+/g, '');
if (!text) return '-';
@@ -355,10 +382,16 @@ export default {
routeNodeName(value, address, transportType, region = {}) {
const text = String(value || '').trim();
if (!text) return '-';
const siteCode = String(region.siteCode || '').trim();
// 运输方式切换不应改变地址本身的展示模式:有站点编码时显示站点名称,
// 没有站点编码的区域地址统一按“市 区县”格式展示。
if (siteCode && siteCode !== '/') return text;
if (
this.isNonRoadLocation({
name: text,
siteCode: region.siteCode,
transportType,
nextTransportType: region.nextTransportType,
})
) {
return text;
}
// 优先从完整的地址名称/详细地址解析,避免后端只返回“梅州”等不完整的市名称时
// 提前返回城市,导致区县被遗漏。
const parsedText = this.formatRoadAddress(text);
@@ -383,86 +416,149 @@ export default {
const source = /省|自治区|特别行政区|市|州|盟/.test(text) ? text : address || text;
const formatted = this.formatRoadAddress(source);
if (/(?:区|县|旗)$/.test(text) && !formatted.includes(text)) {
const city = formatted.split(' ')[0];
return city && city !== formatted ? `${city} ${text}` : formatted;
const cityName = formatted.split(' ')[0];
return cityName && cityName !== formatted ? `${cityName} ${text}` : 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 = {}) {
const routes = row.routeProgress || [];
const total = this.routeNumber(row.totalQuantity);
const firstTransportType = routes[0]?.transportType || row.routes?.[0]?.transportType || row.transportType || '';
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 [
{
key: 'start',
type: 'start',
text: '起',
name: this.routeNodeName(
row.departureName || row.departureAddress,
row.departureAddress,
firstTransportType,
{
cityName: row.departureCityName,
districtName: row.departureDistrictName,
siteCode: row.departureSiteCode,
}
),
...start,
lines: [`已调度0/${total}吨`],
},
{
key: 'end',
type: 'end',
text: '终',
name: this.routeNodeName(
row.arrivalName || row.arrivalAddress,
row.arrivalAddress,
row.finalTransportType || firstTransportType,
{
cityName: row.arrivalCityName,
districtName: row.arrivalDistrictName,
siteCode: row.arrivalSiteCode,
}
),
...end,
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 [
{
key: 'start',
type: 'start',
text: '起',
name: this.routeNodeName(
row.departureName || row.departureAddress,
row.departureAddress,
firstTransportType,
{
cityName: row.departureCityName,
districtName: row.departureDistrictName,
siteCode: row.departureSiteCode,
}
),
...start,
lines: [`已调度${this.routeNumber(routes[0]?.dispatchedQuantity)}/${total}吨`],
},
...routes.map((route, index) => {
const isEnd = index === routes.length - 1;
const arrived = this.routeNumber(this.routeArrivedQuantity(route));
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 {
key: route.segmentNo || `route-${index}`,
type: isEnd ? 'end' : 'middle',
text: isEnd ? '终' : '经',
name: this.routeNodeName(
route.arrivalName || route.departureName || row.arrivalName,
route.arrivalAddress || route.departureAddress,
route.transportType,
{
cityName: route.arrivalCityName || route.departureCityName,
districtName: route.arrivalDistrictName || route.departureDistrictName,
siteCode: route.arrivalSiteCode || route.departureSiteCode,
}
),
...location,
lines: isEnd
? [`到达${arrived}/${total}吨`]
: [`到达 ${arrived}/${total}吨`, `已调度 ${dispatched}/到达${arrived}/${total}吨`],
@@ -494,31 +590,43 @@ export default {
</script>
<style scoped lang="scss">
.master-search {
margin-bottom: 12px;
padding: 12px 12px 4px;
background: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
.el-form-item {
.master-order-page {
&__search {
padding: 12px 12px 4px;
margin-bottom: 8px;
background: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
&__search-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 8px 24px;
}
&__search-actions {
display: flex;
grid-column: 1 / -1;
justify-content: flex-end;
align-items: center;
gap: 8px;
min-height: 32px;
}
:deep(.el-form-item) {
margin-bottom: 8px;
}
.el-input,
.el-select,
.el-date-editor {
width: 100%;
}
:deep(.el-form-item__label) {
white-space: nowrap;
}
.search-actions {
display: flex;
justify-content: flex-end;
align-items: center;
gap: 12px;
min-height: 40px;
.el-icon {
margin-right: 4px;
}
:deep(.el-input),
:deep(.el-select),
:deep(.el-date-editor.el-input),
:deep(.el-date-editor.el-input__wrapper),
:deep(.el-date-editor--datetimerange) {
width: 100%;
}
}
.master-list-panel {
@@ -612,10 +720,16 @@ export default {
line-height: 1.8;
white-space: nowrap;
strong {
display: inline-block;
max-width: 150px;
overflow: hidden;
font-size: 14px;
font-weight: 600;
line-height: 1.4;
max-width: 180px;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: bottom;
cursor: default;
}
}
.route-connector {
@@ -0,0 +1,149 @@
<template>
<div ref="page" class="project-apply-public-view">
<project-apply ref="project" />
</div>
</template>
<script>
import ProjectApply from './project-apply.vue';
import { postMkPublicProcessMessage } from '@/api/mk-process';
export default {
name: 'ProjectApplyPublicView',
components: {
ProjectApply,
},
created() {
this.handleIframeHeight = () => this.sendIframeHeight();
this.handleProcessMessage = event => this.onProcessMessage(event);
document.addEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.addEventListener('message', this.handleProcessMessage);
},
mounted() {
document.documentElement.classList.add('mk-iframe-page');
document.body.classList.add('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.add('mk-iframe-page');
this.handleIframeHeight();
window.addEventListener('load', this.handleIframeHeight);
this.mkHeightTimers = [300, 800, 1600].map(delay => setTimeout(this.handleIframeHeight, delay));
if (typeof ResizeObserver === 'undefined') return;
this.mkHeightObserver = new ResizeObserver(() => this.handleIframeHeight());
this.$nextTick(() => {
if (this.$refs.page) this.mkHeightObserver.observe(this.$refs.page);
this.mkHeightObserver.observe(document.body);
});
},
beforeUnmount() {
document.removeEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.removeEventListener('load', this.handleIframeHeight);
window.removeEventListener('message', this.handleProcessMessage);
(this.mkHeightTimers || []).forEach(timer => clearTimeout(timer));
if (this.mkHeightObserver) {
this.mkHeightObserver.disconnect();
this.mkHeightObserver = null;
}
document.documentElement.classList.remove('mk-iframe-page');
document.body.classList.remove('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.remove('mk-iframe-page');
},
methods: {
sendIframeHeight() {
this.$nextTick(() => {
window.parent.postMessage({ height: document.body.clientHeight }, '*');
});
},
onProcessMessage(event) {
const data = event && event.data;
if (!data || typeof data !== 'object') return;
if (data.height && !data.status && !data.type) return;
if (data.type === 'formValues' || data.type === 'afterSubmit') return;
const formValues = data.formValues;
if (data.status === 'submit') {
this.submitData(formValues);
} else if (data.status === 'save') {
this.saveData(formValues);
}
if (data.type === 'getFormValues') {
window.parent.postMessage({ type: 'formValues', formData: this.buildFormData() }, '*');
}
},
submitData(lbpmFormValues) {
const formData = this.buildFormData();
this.postFormData('submit', lbpmFormValues, formData);
if (!lbpmFormValues) return;
const parameters = Object.assign({}, lbpmFormValues, {
loginName: this.getLoginName(lbpmFormValues),
formInstanceId: this.getFormId(),
subject: formData.subject,
});
window.parent.postMessage({ type: 'afterSubmit', success: true, parameters }, '*');
},
saveData(lbpmFormValues) {
this.postFormData('save', lbpmFormValues, this.buildFormData());
},
postFormData(status, formValues, formData) {
postMkPublicProcessMessage('project-apply', {
status,
formValues: formValues || {},
formData,
}).catch(error => {
console.error('项目公开页提交流程数据失败:', error);
});
},
buildFormData() {
const form = this.getProjectForm();
return {
...form,
subject: form.projectName || form.projectShortName || '',
formInstanceId: this.getFormId(),
};
},
getProjectForm() {
const form = this.$refs.project && this.$refs.project.form;
if (!form) return {};
try {
return JSON.parse(JSON.stringify(form));
} catch (error) {
return { ...form };
}
},
getFormId() {
return this.$route.query.id || this.getProjectForm().id || '';
},
getLoginName(formValues = {}) {
return (
formValues.loginName ||
this.$route.query.loginName ||
this.$route.query.submitIdentity ||
''
);
},
},
};
</script>
<style lang="scss">
html.mk-iframe-page,
html.mk-iframe-page body,
html.mk-iframe-page #app,
html.mk-iframe-page #app.mk-iframe-page {
height: auto !important;
min-height: 100%;
overflow: visible;
}
</style>
<style lang="scss" scoped>
.project-apply-public-view {
min-height: 100%;
padding: 12px 0 24px;
box-sizing: border-box;
background: #f0f2f5;
:deep(.basic-container) {
padding: 0 12px;
}
}
</style>
+217 -84
View File
@@ -1,5 +1,5 @@
<template>
<basic-container class="project-apply-page">
<basic-container class="project-apply-page" :class="{ 'is-public-view': isPublicViewPage }">
<avue-crud
v-if="!isProjectFormPage"
:option="tableOption"
@@ -196,7 +196,7 @@
<el-form-item label="项目编号" prop="projectCode">
<el-input
v-model="form.projectCode"
placeholder="请输入"
:placeholder="dialogType === 'add' ? '若不填写,系统自动生成' : '请输入'"
:disabled="dialogType === 'edit'"
/>
</el-form-item>
@@ -525,6 +525,11 @@
</template>
</el-table-column>
<el-table-column prop="companyNature" label="企业性质" min-width="140" align="center" />
<el-table-column label="是否广西百强" min-width="140" align="center">
<template #default="{ row }">
{{ formatGuangxiTop100(row.guangxiTop100) }}
</template>
</el-table-column>
<el-table-column prop="legalPerson" label="法定代表人" min-width="140" align="center" />
<el-table-column
prop="address"
@@ -703,6 +708,7 @@
label="变更内容"
min-width="180"
align="center"
:show-overflow-tooltip="false"
>
<template #default="{ row }">
<el-tooltip placement="top" :show-after="200">
@@ -730,43 +736,10 @@
</el-table-column>
</el-table>
<el-dialog
<change-record-detail-dialog
v-model="changeRecordDetailVisible"
title="变更记录详情"
append-to-body
destroy-on-close
width="1100px"
top="10px"
class="project-change-record-detail-dialog"
>
<div v-if="changeRecordDetail" class="project-change-record-detail-meta">
<span>变更日期:{{ changeRecordDetail.changeDate || '-' }}</span>
<span>变更账号:{{ changeRecordDetail.handler || '-' }}</span>
</div>
<el-table :data="changeRecordDetailRows" border :show-overflow-tooltip="false">
<el-table-column prop="field" label="变更字段" min-width="180" />
<el-table-column
prop="before"
label="变更前"
min-width="360"
class-name="project-change-record-detail-value"
/>
<el-table-column
prop="after"
label="变更后"
min-width="500"
class-name="project-change-record-detail-value"
/>
</el-table>
<el-empty
v-if="!changeRecordDetailRows.length"
description="暂无变更内容"
:image-size="60"
/>
<template #footer>
<el-button type="primary" @click="changeRecordDetailVisible = false">关闭</el-button>
</template>
</el-dialog>
:rows="changeRecordDetailRows"
/>
<template v-if="isChangeDialog">
<div class="dialog-section-title">变更原因</div>
@@ -784,15 +757,13 @@
</el-form>
<div
v-if="!isPublicViewPage"
class="project-apply-dialog__footer"
:class="{ 'project-apply-dialog__footer--change': isChangeDialog }"
>
<template v-if="isChangeDialog">
<el-button v-if="!isProjectFormPage" @click="handleCancelProject">取消</el-button>
<el-button v-if="isProjectFormPage" @click="closeProjectForm">取消</el-button>
<el-button type="primary" plain :loading="submitLoading" @click="saveChangeProject">
保存
</el-button>
<el-button type="primary" :loading="submitLoading" @click="submitChangeProject">
提交
</el-button>
@@ -909,12 +880,29 @@
/>
</div>
</el-dialog>
<el-dialog
v-model="publicCustomerVisible"
title="查看客商档案"
append-to-body
destroy-on-close
width="92%"
top="4vh"
class="project-apply-public-customer-dialog"
>
<customer-archive
v-if="publicCustomerVisible"
:embedded-public-id="publicCustomerId"
/>
</el-dialog>
</basic-container>
</template>
<script>
import { exportBlob } from '@/api/common';
import { defineAsyncComponent } from 'vue';
import * as api from '@/api/business/project-apply';
import { getMkPublicDetail } from '@/api/mk-process';
import {
getList as getCustomerArchiveList,
getDetail as getCustomerArchiveDetail,
@@ -925,9 +913,11 @@ import { getDictionary as getBizDictionary } from '@/api/system/dictbiz';
import { getList as getUserList } from '@/api/system/user';
import { getToken } from '@/utils/auth';
import { downloadFileByUrl, downloadXls } from '@/utils/util';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
import { ElImageViewer } from 'element-plus';
import { OpenFileViewer } from '@open-file-viewer/vue';
import PdfPreview from '@/components/pdf-preview/main.vue';
import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue';
import {
fallbackPlugin,
imagePlugin,
@@ -1044,7 +1034,10 @@ const majorProjectAttachmentTypeOptions = [
].map(item => ({ label: item, value: item })).concat(otherAttachmentType);
export default {
name: 'ProjectApply',
components: {
CustomerArchive: defineAsyncComponent(() => import('@/views/vehicle/customer-archive.vue')),
ChangeRecordDetailDialog,
ElImageViewer,
OpenFileViewer,
PdfPreview,
@@ -1116,6 +1109,10 @@ export default {
total: 0,
},
selectionList: [],
// 表单页实例标记:创建时按路由落定,不随 keep-alive 切走后的 $route 变化翻转。
// 否则 isProjectFormPage 变 false 后容器会从 div 切成 el-dialog(append-to-body),
// 盖住后续打开的页面(如客商档案)。
isFormPageInstance: false,
projectBox: false,
dialogType: 'add',
dialogReadonly: false,
@@ -1234,6 +1231,8 @@ export default {
changeRecordDetail: null,
changeRecordDetailRows: [],
userBox: false,
publicCustomerVisible: false,
publicCustomerId: '',
userPickType: '',
userLoading: false,
userData: [],
@@ -1308,13 +1307,17 @@ export default {
return ['add', 'majorSupplement'].includes(this.dialogType);
},
isProjectFormPage() {
return this.$route.path === '/business/project-apply/form';
return this.isFormPageInstance;
},
isPublicViewPage() {
return this.$route.path === '/business/project-apply/public-view';
},
projectFormContainer() {
return this.isProjectFormPage ? 'div' : 'el-dialog';
// 表单页实例始终用页面容器,避免 keep-alive 失活时误切弹窗
return this.isFormPageInstance ? 'div' : 'el-dialog';
},
projectFormContainerProps() {
if (this.isProjectFormPage) return { class: 'project-apply-page-form' };
if (this.isFormPageInstance) return { class: 'project-apply-page-form' };
return {
modelValue: this.projectBox,
title: this.projectDialogTitle,
@@ -1355,15 +1358,36 @@ export default {
},
},
created() {
if (this.isPublicViewPage) {
this.isFormPageInstance = true;
this.openPublicProjectForm();
return;
}
this.loadDeptOptions();
this.loadCargoTypeOptions();
this.loadTransportTypeOptions();
this.loadSettlementModeOptions();
if (this.isProjectFormPage) {
if (this.$route.path === '/business/project-apply/form') {
this.isFormPageInstance = true;
this.openProjectFormPage();
}
},
// 标签切走(keep-alive 缓存)或销毁时,收起 append-to-body 的内层弹窗,
// 避免 Teleport 出去的 DOM 继续盖住后续页面。
deactivated() {
this.closeInnerDialogs();
},
beforeUnmount() {
this.closeInnerDialogs();
},
methods: {
closeInnerDialogs() {
this.changeRecordDetailVisible = false;
this.attachmentDocumentPreviewVisible = false;
this.attachmentImagePreviewVisible = false;
this.userBox = false;
this.publicCustomerVisible = false;
},
buildTableOption() {
return {
...option,
@@ -1385,6 +1409,75 @@ export default {
hasPermission(code) {
return this.isAdmin || this.validData(this.permission && this.permission[code], false);
},
openPublicProjectForm() {
const id = this.$route.query.id;
this.dialogType = 'view';
this.dialogReadonly = true;
this.projectBox = true;
if (!id) {
this.$message.error('缺少项目ID');
return;
}
getMkPublicDetail('project-apply', id)
.then(res => {
const detail = res.data?.data || {};
this.applyPublicDictOptions(detail);
const displayDetail = { ...detail };
delete displayDetail.cargoTypeOptions;
delete displayDetail.transportTypeOptions;
delete displayDetail.settlementModeOptions;
this.applyProjectDetail(displayDetail);
})
.catch(() => {
this.$message.error('项目信息加载失败');
});
},
applyPublicDictOptions(detail = {}) {
this.cargoTypeOptions = this.resolvePublicDictOptions(
detail.cargoTypeOptions,
detail.cargoType
);
this.transportTypeOptions = this.resolvePublicDictOptions(
detail.transportTypeOptions,
detail.transportType
);
this.settlementModeOptions = this.resolvePublicDictOptions(
detail.settlementModeOptions,
detail.settlementMode
);
if (detail.businessDeptId) {
const label = detail.businessDeptName || String(detail.businessDeptId);
this.businessDeptTreeOptions = [{ label, value: detail.businessDeptId }];
this.deptOptions = [{ label, rawLabel: label, value: detail.businessDeptId }];
}
if (detail.undertakeDeptId) {
this.platformCompanyOptions = [
{
label: detail.undertakeDeptName || String(detail.undertakeDeptId),
value: detail.undertakeDeptId,
},
];
}
},
resolvePublicDictOptions(options, currentValue) {
const list = Array.isArray(options)
? options
.filter(item => item && item.value !== undefined && item.value !== null && item.value !== '')
.map(item => ({
label: item.label || String(item.value),
value: item.value,
}))
: [];
if (
currentValue !== undefined &&
currentValue !== null &&
currentValue !== '' &&
!list.some(item => String(item.value) === String(currentValue))
) {
list.unshift({ label: String(currentValue), value: currentValue });
}
return list;
},
openProjectFormPage() {
const type = this.$route.query.mode || 'add';
const id = this.$route.query.id;
@@ -1399,6 +1492,7 @@ export default {
this.fillDefaultUsers();
return;
}
if (!id) return;
this.api.getDetail(id).then(res => {
const detail = res.data.data || {};
const isChange = type === 'change';
@@ -1569,7 +1663,17 @@ export default {
}
const run = value => {
const args = operation.prompt ? [row.id, value] : [row.id];
this.api[operation.action](...args).then(res => {
const request = () => this.api[operation.action](...args);
const afterMk =
operation.action === 'submitApproval'
? submitMkApprovalFlow({
bizType: 'project-apply',
formInstanceId: row.id,
subjectName: row.projectName || '',
approvalStatus: row.approvalStatus || '',
}).then(() => request())
: request();
afterMk.then(res => {
if (res.data?.success === false || res.data?.data === false) {
this.$message.error(res.data?.msg || `${operation.label}失败,请联系管理员`);
return;
@@ -1737,9 +1841,26 @@ export default {
this.$message.error(res.data?.msg || '保存失败,请联系管理员');
return;
}
this.$message.success('操作成功!');
this.closeProjectForm();
this.onLoad(this.page, this.query);
const data = res.data?.data || {};
const id = data.id || this.form.id;
const name = data.projectName || this.form.projectName || '';
const status = data.approvalStatus || this.form.approvalStatus || '';
if (!id) {
this.$message.success('操作成功!');
this.closeProjectForm();
this.onLoad(this.page, this.query);
return;
}
return submitMkApprovalFlow({
bizType: 'project-apply',
formInstanceId: id,
subjectName: name,
approvalStatus: status,
}).then(() => {
this.$message.success('提交成功!');
this.closeProjectForm();
this.onLoad(this.page, this.query);
});
},
error => {
window.console.log(error);
@@ -1784,13 +1905,7 @@ export default {
this.closeProjectForm();
});
},
saveChangeProject() {
this.submitChangeForm(false);
},
submitChangeProject() {
this.submitChangeForm(true);
},
submitChangeForm(needSubmit) {
this.$refs.projectForm.validate(valid => {
if (!valid) {
this.handleValidateFail();
@@ -1798,18 +1913,25 @@ export default {
}
if (!this.validateAttachmentFileTypes()) return;
this.submitLoading = true;
const request = needSubmit ? this.api.submitChange : this.api.saveChange;
request(this.normalizeSubmitForm({ includeChangeType: true }))
// 变更记录仅在提交时生成,保存草稿不落记录
this.api
.submitChange(this.normalizeSubmitForm({ includeChangeType: true }))
.then(res => {
if (res.data?.success === false || res.data?.data === false) {
this.$message.error(
res.data?.msg || `${needSubmit ? '提交' : '保存'}失败,请联系管理员`
);
this.$message.error(res.data?.msg || '提交失败,请联系管理员');
return;
}
this.$message.success(`${needSubmit ? '提交' : '保存'}成功!`);
this.closeProjectForm();
this.onLoad(this.page, this.query);
const id = this.form.id;
return submitMkApprovalFlow({
bizType: 'project-apply',
formInstanceId: id,
subjectName: this.form.projectName || '',
approvalStatus: this.form.approvalStatus || 'change_rejected',
}).then(() => {
this.$message.success('提交成功!');
this.closeProjectForm();
this.onLoad(this.page, this.query);
});
})
.finally(() => {
this.submitLoading = false;
@@ -1950,6 +2072,11 @@ export default {
this.$message.warning('客商档案 ID 为空,无法打开');
return;
}
if (this.isPublicViewPage) {
this.publicCustomerId = String(id);
this.publicCustomerVisible = true;
return;
}
this.$router.push({
path: '/vehicle/customer-archive/form',
query: { id: String(id), name: '查看客商档案', view: '1' },
@@ -1984,6 +2111,11 @@ export default {
normalizeReadonlyAmount(value) {
return this.normalizeOptionalSentinel(value);
},
formatGuangxiTop100(value) {
if (value === 1 || value === '1') return '是';
if (value === 0 || value === '0') return '否';
return value || '';
},
normalizeOptionalSentinel(value, emptyValue = '') {
return value === null || value === undefined || value === '' || Number(value) === -1
? emptyValue
@@ -2390,6 +2522,8 @@ export default {
id: item.id,
credit: item.maxCreditLimit || item.applyCreditLimit || '',
companyNature: item.customerNature || '',
guangxiTop100:
item.guangxiTop100 === 0 || item.guangxiTop100 === 1 ? item.guangxiTop100 : null,
legalPerson: item.legalPerson || '',
address: item.registeredAddress || '',
contact: defaultContact.contactName || item.principal || '',
@@ -2532,6 +2666,12 @@ export default {
this.$message.warning('项目ID为空,无法查看变更详情');
return;
}
if (this.isPublicViewPage) {
this.changeRecordDetail = { ...row };
this.changeRecordDetailRows = this.buildChangeRecordDetailRows(this.changeRecordDetail);
this.changeRecordDetailVisible = true;
return;
}
try {
if (!this.transportTypeOptions.length) {
await this.loadTransportTypeOptions();
@@ -2588,6 +2728,12 @@ export default {
</script>
<style lang="scss" scoped>
.project-apply-page.is-public-view {
:deep(.el-link) {
pointer-events: auto;
}
}
.project-apply-form {
padding: 0;
@@ -2820,27 +2966,6 @@ export default {
}
}
:deep(.project-change-record-detail-dialog .el-dialog__body) {
max-height: 65vh;
overflow: auto;
}
:deep(.project-change-record-detail-dialog .project-change-record-detail-value .cell) {
white-space: pre-wrap;
word-break: break-word;
overflow: visible;
text-overflow: clip;
line-height: 1.6;
}
.project-change-record-detail-meta {
display: flex;
gap: 32px;
margin-bottom: 16px;
color: #606266;
font-size: 14px;
}
:global(.project-apply-dialog .el-dialog__body) {
max-height: 76vh;
overflow-y: auto;
@@ -2957,3 +3082,11 @@ export default {
}
}
</style>
<style lang="scss">
.project-apply-public-customer-dialog .el-dialog__body {
max-height: 78vh;
overflow: auto;
padding-top: 8px;
}
</style>
+117 -25
View File
@@ -99,13 +99,25 @@
<el-table :data="attachmentRows" border @selection-change="selectedAttachments = $event">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column label="文件名" min-width="240" show-overflow-tooltip>
<el-table-column label="文件名称" min-width="240" show-overflow-tooltip>
<template #default="{ row }">
<el-link type="primary" @click="previewAttachment(row)">
{{ attachmentName(row) }}
</el-link>
</template>
</el-table-column>
<el-table-column label="附件描述" min-width="220">
<template #default="{ row }">
<span v-if="dialogReadonly">{{ row.description || '-' }}</span>
<el-input
v-else
v-model="row.description"
maxlength="200"
placeholder="请输入"
@input="syncAttachmentsJson"
/>
</template>
</el-table-column>
<el-table-column label="文件大小" width="120" align="center">
<template #default="{ row }">{{ formatFileSize(row.size) }}</template>
</el-table-column>
@@ -172,7 +184,7 @@
title="查看临时额度申请"
append-to-body
destroy-on-close
width="96%"
:width="formDialogWidth"
class="temporary-credit-limit-dialog temporary-credit-limit-detail-dialog"
>
<div v-loading="detailLoading" class="business-crud-page__detail-content">
@@ -204,13 +216,16 @@
</div>
<el-table :data="attachmentRows" empty-text="暂无附件">
<el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column label="文件名" min-width="240" show-overflow-tooltip>
<el-table-column label="文件名称" min-width="240" show-overflow-tooltip>
<template #default="{ row }">
<el-link type="primary" @click="previewAttachment(row)">
{{ attachmentName(row) }}
</el-link>
</template>
</el-table-column>
<el-table-column label="附件描述" min-width="220" show-overflow-tooltip>
<template #default="{ row }">{{ row.description || '-' }}</template>
</el-table-column>
<el-table-column label="文件大小" width="120" align="center">
<template #default="{ row }">{{ formatFileSize(row.size) }}</template>
</el-table-column>
@@ -400,6 +415,13 @@ export default {
detailSections() {
return this.config.detailSections || [];
},
formDialogWidth() {
const width = this.tableOption?.dialogWidth ?? option.dialogWidth ?? 1100;
if (typeof width === 'number' || /^\d+$/.test(String(width))) {
return `${width}px`;
}
return String(width);
},
isAdmin() {
const authority = this.userInfo?.authority;
return Array.isArray(authority)
@@ -595,7 +617,12 @@ export default {
return value;
},
applyDetail(detail) {
this.form = { ...detail };
this.form = {
...detail,
projectFundLimit: this.blankSentinelAmount(detail.projectFundLimit),
usedFundLimit: this.blankSentinelAmount(detail.usedFundLimit),
remainingFundLimit: this.blankSentinelAmount(detail.remainingFundLimit),
};
this.selectedProjectId = detail.projectId || '';
this.attachmentRows = this.parseJsonArray(detail.attachmentsJson);
this.selectedAttachments = [];
@@ -605,6 +632,9 @@ export default {
const { projectQuotaInfoTitle, temporaryCreditInfoTitle, ...payload } = row || {};
return {
...payload,
projectFundLimit: this.toOptionalAmount(payload.projectFundLimit),
usedFundLimit: this.toOptionalAmount(payload.usedFundLimit),
remainingFundLimit: this.toOptionalAmount(payload.remainingFundLimit),
applyLimit: payload.applyLimit === '' ? '' : Number(payload.applyLimit),
attachmentsJson: JSON.stringify(this.attachmentRows),
};
@@ -750,8 +780,8 @@ export default {
projectName: project.projectName || '',
projectCode: project.projectCode || '',
undertakeDeptName: project.undertakeDeptName || '',
projectFundLimit: project.fundLimit || project.projectFundLimit || 0,
usedFundLimit: project.usedFundLimit || 0,
projectFundLimit: this.blankSentinelAmount(project.fundLimit ?? project.projectFundLimit),
usedFundLimit: this.blankSentinelAmount(project.usedFundLimit),
});
this.form.remainingFundLimit = this.calculateRemainingFundLimit();
getProjectDetail(project.id).then(res => {
@@ -759,18 +789,32 @@ export default {
Object.assign(this.form, {
projectCode: detail.projectCode || this.form.projectCode,
undertakeDeptName: detail.undertakeDeptName || this.form.undertakeDeptName,
projectFundLimit:
detail.fundLimit ?? detail.projectFundLimit ?? this.form.projectFundLimit,
usedFundLimit: detail.usedFundLimit ?? this.form.usedFundLimit,
projectFundLimit: this.blankSentinelAmount(
detail.fundLimit ?? detail.projectFundLimit ?? this.form.projectFundLimit
),
usedFundLimit: this.blankSentinelAmount(
detail.usedFundLimit ?? this.form.usedFundLimit
),
});
this.form.remainingFundLimit = this.calculateRemainingFundLimit();
});
},
blankSentinelAmount(value) {
if (value === undefined || value === null || value === '') return '';
return Number(value) === -1 ? '' : value;
},
toOptionalAmount(value) {
const amount = this.blankSentinelAmount(value);
return amount === '' ? null : amount;
},
calculateRemainingFundLimit() {
const total = Number(this.form.projectFundLimit);
const used = Number(this.form.usedFundLimit);
if (!Number.isFinite(total) || !Number.isFinite(used)) return '';
return Math.round((total - used + Number.EPSILON) * 100) / 100;
const total = this.blankSentinelAmount(this.form.projectFundLimit);
const used = this.blankSentinelAmount(this.form.usedFundLimit);
if (total === '' || used === '') return '';
const totalAmount = Number(total);
const usedAmount = Number(used);
if (!Number.isFinite(totalAmount) || !Number.isFinite(usedAmount)) return '';
return Math.round((totalAmount - usedAmount + Number.EPSILON) * 100) / 100;
},
handleAmountInput(value) {
const text = String(value || '').replace(/[^\d.]/g, '');
@@ -783,24 +827,37 @@ export default {
const uploadTime = this.$dayjs().format('YYYY-MM-DD HH:mm:ss');
this.attachmentRows = (list || []).map(item => ({
...item,
description: item.description || '',
uploadUserName: item.uploadUserName || uploadUserName,
uploadTime: item.uploadTime || uploadTime,
}));
this.form.attachmentsJson = JSON.stringify(this.attachmentRows);
this.syncAttachmentsJson();
},
removeAttachment(index) {
this.attachmentRows.splice(index, 1);
this.form.attachmentsJson = JSON.stringify(this.attachmentRows);
this.syncAttachmentsJson();
},
syncAttachmentsJson() {
this.form.attachmentsJson = JSON.stringify(this.attachmentRows || []);
},
parseJsonArray(value) {
if (Array.isArray(value)) return value;
if (!value) return [];
try {
const data = JSON.parse(value);
return Array.isArray(data) ? data : [];
} catch (error) {
let list = [];
if (Array.isArray(value)) {
list = value;
} else if (!value) {
return [];
} else {
try {
const data = JSON.parse(value);
list = Array.isArray(data) ? data : [];
} catch (error) {
return [];
}
}
return list.map(item => ({
...item,
description: item?.description || '',
}));
},
attachmentName(row = {}) {
return row.originalName || row.name || row.fileName || '附件';
@@ -906,7 +963,8 @@ export default {
<style lang="scss" scoped>
.temporary-credit-limit-page {
&__field {
width: 100%;
width: 240px;
max-width: 100%;
}
&__attachment-head {
@@ -993,7 +1051,7 @@ export default {
align-items: center;
gap: 8px;
width: 100%;
padding: 14px 16px 4px;
padding: 14px 0 4px;
margin-bottom: 0;
color: #303133;
font-size: 15px;
@@ -1086,17 +1144,51 @@ export default {
background: transparent !important;
box-shadow: none !important;
margin: 0 !important;
padding: 0 !important;
padding: 0 16px 8px !important;
border-radius: 0 !important;
}
// 新增/编辑:input/select 与「项目名称」同宽(240px),备注 textarea 保持整行
&:not(.temporary-credit-limit-detail-dialog) {
.el-form-item__content {
min-width: 0;
}
.el-form-item__content > .el-input,
.el-form-item__content > .el-select,
.el-form-item__content > .el-date-editor,
.el-form-item__content > .el-cascader,
.el-form-item__content > div > .el-input,
.el-form-item__content > div > .el-select,
.el-form-item__content > div > .el-date-editor,
.el-form-item__content > div > .el-cascader,
.temporary-credit-limit-page__field {
width: 240px !important;
max-width: 100%;
}
.el-form-item__content > .el-textarea,
.el-form-item__content > div > .el-textarea,
.el-form-item__content .el-textarea {
width: 100% !important;
max-width: 100% !important;
}
.el-date-editor.el-input,
.el-date-editor.el-input__wrapper {
width: 240px !important;
max-width: 100%;
}
}
}
.temporary-credit-limit-dialog .business-crud-page__detail-content .el-descriptions__label {
width: 180px !important;
}
// 新增/编辑/查看:高度随内容自适应,超出时再滚动;去掉强制全屏导致的底部大片空白
// 新增/编辑/查看:宽度与高度规则统一(Avue setPx 对 '1100px' 会拼成 '1100pxpx',故 option 用数字 1100)
.temporary-credit-limit-dialog.el-dialog {
width: 1100px !important;
margin-top: 20px !important;
margin-bottom: 20px !important;
height: auto !important;
+459 -249
View File
@@ -1,116 +1,113 @@
<template>
<basic-container class="transport-plan-dispatch-page">
<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-title">
<el-button icon="el-icon-arrow-left" text @click="handleBack">返回</el-button>
<span class="transport-plan-dispatch-page__heading-name">计划调度</span>
<span class="transport-plan-dispatch-page__heading-no">
{{ planData.planNo || planData.loadingNo || '-' }}
<el-button icon="el-icon-arrow-left" text @click="handleBack">返回</el-button>
<strong>计划调度</strong>
<span>{{ planData.planNo || planData.loadingNo || '-' }}</span>
<span class="detail-status-text" :class="statusTextClass">
{{ planData.businessStatusName || '-' }}
</span>
<span class="detail-status-text detail-transport-type">
{{ transportTypeLabel }}
</span>
</div>
<div class="transport-plan-dispatch-page__summary-grid">
<div class="transport-plan-dispatch-page__summary-item">
<span class="transport-plan-dispatch-page__summary-label">客户</span>
<span class="transport-plan-dispatch-page__summary-value">
{{ planData.customerName || '-' }}
</span>
<el-tag :type="getStatusTagType(planData.businessStatus)" effect="light" class="status-text">
{{ planData.businessStatusName || '-' }}
</el-tag>
<el-tag type="primary" effect="light">
{{ planData.transportTypeName || '公路整车' }}
</el-tag>
</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 is-link">
{{ planData.contractNo || '-' }}
</span>
</div>
<div class="transport-plan-dispatch-page__summary-item">
<span class="transport-plan-dispatch-page__summary-label">项目</span>
<span class="transport-plan-dispatch-page__summary-value">
{{ planData.projectName || '-' }}
</span>
</div>
<div class="transport-plan-dispatch-page__summary-item">
<span class="transport-plan-dispatch-page__summary-label">计划执行时间</span>
<span class="transport-plan-dispatch-page__summary-value">
{{ formatDateRange(planData.planStartDate, planData.planEndDate) }}
</span>
</div>
<div class="transport-plan-dispatch-page__summary-item is-goods">
<span class="transport-plan-dispatch-page__summary-label">货物信息</span>
<span class="transport-plan-dispatch-page__summary-value is-wrap">
{{ planData.goodsInfo || formatGoodsInfo(planData) }}
</span>
</div>
<div class="transport-plan-dispatch-page__route">
<div class="transport-plan-dispatch-page__route-item is-start">
<div class="transport-plan-dispatch-page__route-marker">起</div>
<div class="transport-plan-dispatch-page__route-detail">
<strong class="transport-plan-dispatch-page__route-name">
{{
formatRouteCityDistrict(planData.departureAddress || planData.departureName)
}}
</strong>
<el-tooltip
:content="planData.departureAddress || planData.departureName || '-'"
placement="top"
>
<span class="transport-plan-dispatch-page__route-addr">
{{ planData.departureAddress || planData.departureName || '-' }}
</span>
</el-tooltip>
<div class="transport-plan-dispatch-page__route-contact">
<span>联系人:{{ planData.departureContact || '-' }}</span>
<span>联系方式:{{ planData.departurePhone || '-' }}</span>
</div>
</div>
</div>
<span class="transport-plan-dispatch-page__route-line" aria-hidden="true" />
<div class="transport-plan-dispatch-page__route-item is-end">
<div class="transport-plan-dispatch-page__route-marker">终</div>
<div class="transport-plan-dispatch-page__route-detail">
<strong class="transport-plan-dispatch-page__route-name">
{{ formatRouteCityDistrict(planData.arrivalAddress || planData.arrivalName) }}
</strong>
<el-tooltip
:content="planData.arrivalAddress || planData.arrivalName || '-'"
placement="top"
>
<span class="transport-plan-dispatch-page__route-addr">
{{ planData.arrivalAddress || planData.arrivalName || '-' }}
</span>
</el-tooltip>
<div class="transport-plan-dispatch-page__route-contact">
<span>联系人:{{ planData.arrivalContact || '-' }}</span>
<span>联系方式:{{ planData.arrivalPhone || '-' }}</span>
</div>
</div>
</div>
</div>
<div class="transport-plan-dispatch-page__attachments">
<span class="transport-plan-dispatch-page__summary-label">附件</span>
<div>
<el-link
v-for="(item, index) in attachmentList"
:key="index"
type="primary"
:href="item.url"
:underline="false"
target="_blank"
>
{{ item.name || item.originalName || '附件' }}
</el-link>
<span v-if="!attachmentList.length">-</span>
</div>
</div>
</div>
<div class="transport-plan-dispatch-page__summary">
<section-card title="基本信息" class="transport-plan-dispatch-page__summary-card">
<div class="transport-plan-dispatch-page__summary-grid">
<div class="transport-plan-dispatch-page__summary-item">
<div class="transport-plan-dispatch-page__summary-label">客户</div>
<div class="transport-plan-dispatch-page__summary-value">
{{ planData.customerName || '-' }}
</div>
</div>
<div class="transport-plan-dispatch-page__summary-item">
<div class="transport-plan-dispatch-page__summary-label">项目</div>
<div class="transport-plan-dispatch-page__summary-value">
{{ planData.projectName || '-' }}
</div>
</div>
<div class="transport-plan-dispatch-page__summary-item">
<div class="transport-plan-dispatch-page__summary-label">合同编号</div>
<div class="transport-plan-dispatch-page__summary-value">
{{ planData.contractNo || '-' }}
</div>
</div>
<div class="transport-plan-dispatch-page__summary-item">
<div class="transport-plan-dispatch-page__summary-label">计划执行时间</div>
<div class="transport-plan-dispatch-page__summary-value">
{{ formatDateRange(planData.planStartDate, planData.planEndDate) }}
</div>
</div>
<div class="transport-plan-dispatch-page__summary-item is-wide">
<div class="transport-plan-dispatch-page__summary-label">货物信息</div>
<div class="transport-plan-dispatch-page__summary-value">
{{ planData.goodsInfo || formatGoodsInfo(planData) }}
</div>
</div>
<div class="transport-plan-dispatch-page__summary-item">
<div class="transport-plan-dispatch-page__summary-label">附件</div>
<div class="transport-plan-dispatch-page__summary-value">
<template v-if="attachmentList.length">
<el-link
v-for="(item, index) in attachmentList"
:key="index"
type="primary"
:href="item.url"
:underline="false"
target="_blank"
class="transport-plan-dispatch-page__attachment-link"
>
{{ item.name || item.originalName || '附件' }}
</el-link>
</template>
<span v-else>-</span>
</div>
</div>
</div>
</section-card>
<section-card title="收发货路线" class="transport-plan-dispatch-page__route-card">
<div class="transport-plan-dispatch-page__route">
<div class="transport-plan-dispatch-page__route-item">
<span class="transport-plan-dispatch-page__route-badge is-start">起</span>
<div class="transport-plan-dispatch-page__route-body">
<div class="transport-plan-dispatch-page__route-title">
{{ planData.departureName || '-' }}
</div>
<div class="transport-plan-dispatch-page__route-address">
{{ formatAddress(planData.departureAddress) }}
</div>
<div class="transport-plan-dispatch-page__route-contact">
{{ formatContact(planData.departureContact, planData.departurePhone) }}
</div>
</div>
</div>
<div class="transport-plan-dispatch-page__route-vehicle">
<el-icon><Van /></el-icon>
</div>
<div class="transport-plan-dispatch-page__route-item">
<span class="transport-plan-dispatch-page__route-badge is-end">终</span>
<div class="transport-plan-dispatch-page__route-body">
<div class="transport-plan-dispatch-page__route-title">
{{ planData.arrivalName || '-' }}
</div>
<div class="transport-plan-dispatch-page__route-address">
{{ formatAddress(planData.arrivalAddress) }}
</div>
<div class="transport-plan-dispatch-page__route-contact">
{{ formatContact(planData.arrivalContact, planData.arrivalPhone) }}
</div>
</div>
</div>
</div>
</section-card>
</div>
</div>
</section-card>
<!-- 调度列表 -->
<section-card class="transport-plan-dispatch-page__list-card">
@@ -126,16 +123,20 @@
</el-button>
</template>
<el-table
:data="dispatchList"
:data="pagedDispatchList"
border
height="100%"
row-key="id"
class="transport-plan-dispatch-page__table"
>
<el-table-column type="index" label="序号" width="70" align="center" fixed="left" />
<el-table-column label="序号" width="70" align="center" fixed="left">
<template #default="{ $index }">
{{ dispatchRowIndex($index) }}
</template>
</el-table-column>
<el-table-column label="运输方式" min-width="180" align="center" show-overflow-tooltip>
<template #default="{ row }">
{{ row.transportTypeName || '-' }}
{{ formatTransportType(row.transportTypeName || row.transportType) }}
</template>
</el-table-column>
<el-table-column prop="carrierType" label="承运类型" min-width="150" align="center" show-overflow-tooltip />
@@ -180,6 +181,17 @@
</template>
</el-table-column>
</el-table>
<div class="transport-plan-dispatch-page__pagination">
<el-pagination
v-model:current-page="dispatchPage.currentPage"
v-model:page-size="dispatchPage.pageSize"
:page-sizes="dispatchPage.pageSizes"
layout="total, sizes, prev, pager, next"
:total="dispatchList.length"
@current-change="handleDispatchCurrentChange"
@size-change="handleDispatchSizeChange"
/>
</div>
</section-card>
<!-- 底部按钮 -->
@@ -204,8 +216,8 @@
</template>
<script>
import { Van } from '@element-plus/icons-vue';
import { getDetail, dispatch } from '@/api/business/transport-plan';
import { getDictionary } from '@/api/system/dictbiz';
import SectionCard from '@/components/section-card/main.vue';
import TransportPlanPage from './components/transport-plan-page.vue';
import * as api from '@/api/business/transport-plan';
@@ -213,10 +225,15 @@ import { config, option } from '@/option/business/transport-plan';
const TRANSPORT_PLAN_QUANTITY_UNIT = '吨';
const normalizeDictOptions = (list = []) =>
(Array.isArray(list) ? list : []).map(item => ({
label: item.dictValue || item.label || '',
value: item.dictKey ?? item.value ?? '',
}));
export default {
name: 'TransportPlanDispatch',
components: {
Van,
SectionCard,
TransportPlanPage,
},
@@ -228,6 +245,12 @@ export default {
dispatchList: [],
attachmentList: [],
transportPlanPageVisible: false,
transportTypeOptions: [],
dispatchPage: {
currentPage: 1,
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
api,
config,
option,
@@ -237,11 +260,30 @@ export default {
planId() {
return this.$route.query.planId;
},
transportTypeLabel() {
return this.formatTransportType(
this.planData.transportTypeName || this.planData.transportType
);
},
pagedDispatchList() {
const start = (this.dispatchPage.currentPage - 1) * this.dispatchPage.pageSize;
return this.dispatchList.slice(start, start + this.dispatchPage.pageSize);
},
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() {
const goodsList = this.parseGoodsList(this.planData.goodsJson);
if (!goodsList.length) {
const total = Number(this.planData.totalQuantity || 0);
const dispatched = this.calculateDispatchedQuantity();
if (total <= 0) {
return `已调度 ${dispatched.toFixed(2)}吨`;
}
const remaining = Math.max(total - dispatched, 0);
return `共${total}吨 | 已调度 ${dispatched.toFixed(2)}吨,剩余${remaining.toFixed(2)}吨`;
}
@@ -264,6 +306,9 @@ export default {
});
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);
return `${data.total}${unit} | 已调度 ${data.dispatched.toFixed(2)}${unit},剩余${remaining.toFixed(
2
@@ -276,13 +321,20 @@ export default {
const goodsList = this.parseGoodsList(this.planData.goodsJson);
if (!goodsList.length) {
const total = Number(this.planData.totalQuantity || 0);
if (total <= 0) return true;
const dispatched = this.calculateDispatchedQuantity();
return dispatched < total;
}
const hasPositiveTotal = goodsList.some(
goods => Number(goods.quantity || 0) > 0
);
if (!hasPositiveTotal) return true;
return goodsList.some(goods => {
const unit = goods.quantityUnit || TRANSPORT_PLAN_QUANTITY_UNIT;
const totalQty = Number(goods.quantity || 0);
if (totalQty <= 0) return true;
const dispatchedQty = this.dispatchList
.filter(item => item.quantityUnit === unit)
.reduce((sum, item) => sum + Number(item.quantity || 0), 0);
@@ -291,13 +343,34 @@ export default {
},
},
created() {
this.loadPlanData();
this.loadTransportTypeOptions().finally(() => {
this.loadPlanData();
});
},
mounted() {
// 初始化 transport-plan-page 组件用于打开弹窗
this.transportPlanPageVisible = true;
},
methods: {
loadTransportTypeOptions() {
return getDictionary({ code: 'transport_type' })
.then(res => {
this.transportTypeOptions = normalizeDictOptions(res.data?.data || []);
})
.catch(() => {
this.transportTypeOptions = [];
});
},
formatTransportType(value) {
const transportType = String(value || '').trim();
if (!transportType) return '-';
// 已是中文标签时直接展示
if (/[\u4e00-\u9fff]/.test(transportType)) return transportType;
const item = this.transportTypeOptions.find(
option => String(option.value ?? '').toLowerCase() === transportType.toLowerCase()
);
return item?.label || transportType;
},
loadPlanData() {
if (!this.planId) {
this.$message.error('缺少计划ID参数');
@@ -312,6 +385,7 @@ export default {
this.planData = res.data.data || {};
this.attachmentList = this.parseAttachments(this.planData.attachmentsJson);
this.dispatchList = this.parseDispatchList(this.planData);
this.dispatchPage.currentPage = 1;
} else {
this.$message.error(res.data?.msg || '加载数据失败');
}
@@ -364,15 +438,6 @@ export default {
calculateDispatchedQuantity() {
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) {
const dates = [startDate, endDate].filter(Boolean);
return dates.length ? dates.join(' ~ ') : '-';
@@ -382,9 +447,30 @@ export default {
const match = address.match(/^(.*?省)?(.*?市)?(.*?区|.*?县)?/);
return match ? match[0] || address : address;
},
formatContact(contact, phone) {
const parts = [contact, phone].filter(Boolean);
return parts.length ? parts.join(' / ') : '-';
formatProvinceCityDistrict(value) {
const text = String(value || '').trim();
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) {
const parts = [row.driverName, row.driverPhone].filter(Boolean);
@@ -419,39 +505,64 @@ export default {
this.$message.warning('待调度列表货物总量已达到计划总量,不能新增调度明细');
return;
}
// 调用 transport-plan-page 组件的方法打开弹窗
this.$nextTick(() => {
const component = this.$refs.transportPlanPageRef;
if (component) {
// 设置调度数据
component.dispatchRow = this.planData;
component.dispatchRows = [...this.dispatchList];
// 打开新增弹窗
component.openDispatchItemDialog(-1);
}
});
this.openPageDispatchItemDialog(-1);
},
dispatchRowIndex(index) {
return (this.dispatchPage.currentPage - 1) * this.dispatchPage.pageSize + index + 1;
},
resolveDispatchGlobalIndex(pageIndex) {
return (this.dispatchPage.currentPage - 1) * this.dispatchPage.pageSize + pageIndex;
},
syncDispatchPage() {
const maxPage = Math.max(
1,
Math.ceil(this.dispatchList.length / this.dispatchPage.pageSize) || 1
);
if (this.dispatchPage.currentPage > maxPage) {
this.dispatchPage.currentPage = maxPage;
}
},
handleDispatchCurrentChange(currentPage) {
this.dispatchPage.currentPage = currentPage;
},
handleDispatchSizeChange(pageSize) {
this.dispatchPage.pageSize = pageSize;
this.dispatchPage.currentPage = 1;
},
handleEdit(row, index) {
// 调用 transport-plan-page 组件的方法打开弹窗
this.openPageDispatchItemDialog(this.resolveDispatchGlobalIndex(index), row);
},
openPageDispatchItemDialog(index = -1, row) {
this.$nextTick(() => {
const component = this.$refs.transportPlanPageRef;
if (component) {
// 设置调度数据
component.dispatchRow = this.planData;
component.dispatchRows = [...this.dispatchList];
// 打开编辑弹窗
component.openDispatchItemDialog(index, row);
}
if (!component) return;
component.dispatchRow = this.planData;
component.dispatchRows = [...this.dispatchList];
this.bindDispatchItemSaveSync(component);
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 || [])];
this.syncDispatchPage();
}
};
component.__dispatchListSaveSynced = true;
},
handleDelete(index) {
this.$confirm('确定删除该调度明细?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
this.dispatchList.splice(index, 1);
this.dispatchList.splice(this.resolveDispatchGlobalIndex(index), 1);
this.syncDispatchPage();
this.$message.success('删除成功');
});
},
@@ -551,126 +662,189 @@ export default {
height: 100%;
}
&__top {
display: flex;
flex-direction: column;
gap: 16px;
&__summary {
:deep(.el-card__body) {
padding: 18px 22px;
}
}
&__heading {
padding: 16px;
background: #fff;
border-radius: 4px;
&-title {
display: flex;
align-items: center;
gap: 12px;
font-size: 18px;
font-weight: 600;
}
&-name {
font-size: 18px;
}
&-no {
font-size: 14px;
color: #606266;
}
}
&__summary {
display: flex;
gap: 16px;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 18px;
&-card {
flex: 1;
strong {
font-size: 20px;
}
&-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 16px;
.detail-status-text {
display: inline-flex;
align-items: center;
height: 28px;
padding: 0 12px;
border-radius: 8px;
font-size: 13px;
line-height: 28px;
}
&-item {
display: flex;
flex-direction: column;
gap: 8px;
&.is-wide {
grid-column: 1 / -1;
}
.status-text-success,
.is-dispatching {
color: #67c23a;
background: #e1f3d8;
}
&-label {
font-size: 14px;
.detail-transport-type {
color: #409eff;
background: #ecf5ff;
}
.is-danger {
color: #f56c6c;
background: #fef0f0;
}
.is-info {
color: #909399;
}
&-value {
font-size: 14px;
color: #303133;
background: #f4f4f5;
}
}
&__route-card {
flex: 1;
&__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;
gap: 24px;
text-align: center;
}
&-item {
flex: 1;
&__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-weight: 600;
.is-end & {
background: #67c23a;
}
}
&__route-line {
width: 100%;
height: 6px;
margin-top: 15px;
border-radius: 1px;
background: #e4e7ed;
}
&__route-detail {
display: flex;
min-width: 0;
flex-direction: column;
align-items: center;
gap: 5px;
margin-top: 8px;
width: 100%;
}
&__route-name {
max-width: 100%;
overflow: hidden;
color: #303133;
font-size: 18px;
font-weight: 600;
line-height: 1.35;
text-overflow: ellipsis;
white-space: nowrap;
}
&__route-addr {
display: block;
max-width: 100%;
overflow: hidden;
color: #606266;
font-size: 12px;
line-height: 1.5;
text-overflow: ellipsis;
white-space: nowrap;
}
&__route-contact {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 2px 8px;
max-width: 100%;
color: #909399;
font-size: 12px;
line-height: 1.5;
}
&__attachments {
grid-column: 1 / 5;
display: flex;
flex-direction: column;
gap: 8px;
div {
display: flex;
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;
flex-wrap: wrap;
gap: 16px;
}
}
@@ -691,6 +865,12 @@ export default {
flex: 1;
}
&__pagination {
display: flex;
justify-content: flex-end;
padding-top: 12px;
}
&__actions {
display: flex;
gap: 8px;
@@ -706,12 +886,42 @@ export default {
border-radius: 4px;
}
&__attachment-link {
margin-right: 12px;
@media (max-width: 1200px) {
&__summary-grid {
grid-template-columns: repeat(4, minmax(130px, 1fr));
}
&__summary-item.is-goods,
&__attachments {
grid-column: 1 / -1;
}
&__route {
grid-column: 1 / -1;
grid-row: auto;
}
}
@media (max-width: 800px) {
&__summary-grid {
grid-template-columns: 1fr;
}
&__route {
grid-template-columns: minmax(0, 1fr);
gap: 16px;
}
&__route-line {
width: 10px;
height: 32px;
margin: 0 auto;
}
&__summary-item.is-goods,
&__attachments {
grid-column: auto;
}
}
}
.status-text {
font-size: 12px;
}
</style>
+1 -1
View File
@@ -76,7 +76,7 @@
<el-button type="primary">添加附件</el-button>
</el-upload>
<span class="transport-plan-import-page__file-tip">
请上传计划明细表,仅支持 Excel 格式
请上传计划明细表,仅支持 Excel 格式;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法
</span>
<el-link type="primary" @click="handleTemplateDownload">下载模板</el-link>
</el-form-item>
+10 -1
View File
@@ -1,9 +1,11 @@
<template>
<!-- 同 waybill-manage-detail.vue:只在当前路由属于本页时才透传 detailId,
避免标签页缓存的实例被其它页面的 detailId 污染后误开详情。 -->
<transport-plan-page
:api="api"
:config="config"
:crud-option="option"
:detail-id="$route.query.detailId"
:detail-id="detailId"
:menu-width="220"
standalone-form-page
/>
@@ -14,6 +16,8 @@ import TransportPlanPage from './components/transport-plan-page.vue';
import * as api from '@/api/business/transport-plan';
import { config, option } from '@/option/business/transport-plan';
const listRoutePath = '/business/transport-plan';
export default {
components: { TransportPlanPage },
data() {
@@ -23,5 +27,10 @@ export default {
option,
};
},
computed: {
detailId() {
return this.$route.path === listRoutePath ? this.$route.query.detailId : '';
},
},
};
</script>
+26 -6
View File
@@ -16,7 +16,9 @@
><el-select v-model="query.processStatus" clearable placeholder="全部"
><el-option label="上传中" value="上传中" /><el-option
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 label="运单批次号"
><el-input v-model="query.waybillBatchNo" clearable placeholder="请输入"
@@ -84,7 +86,14 @@
min-width="160"
><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"
label="凭证数量"
width="100"
@@ -109,7 +118,7 @@
placement="top"
><el-icon class="voucher-manage-page__audit-reject-icon"><WarnTriangleFilled /></el-icon
></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 }"
><div class="voucher-manage-page__actions">
<el-link
@@ -130,7 +139,7 @@
@click="download(row)"
>下载</el-link
><el-link
v-if="row.auditStatus === '审核驳回'"
v-if="row.auditStatus === '审核驳回' || row.processStatus === '处理失败'"
type="primary"
@click="openUpload(row, 'reupload')"
>重新上传</el-link
@@ -145,7 +154,7 @@
@click="openBatchDialog(row)"
>更换运单批次</el-link
><el-link
v-if="row.processStatus === '上传中' || row.auditStatus === '审核驳回'"
v-if="row.processStatus === '上传中' || row.processStatus === '处理失败' || row.auditStatus === '审核驳回'"
type="danger"
@click="removeRow(row)"
>删除</el-link
@@ -1238,7 +1247,15 @@ const view = async row => {
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 =>
ElMessageBox.confirm(`确认审核通过凭证批次"${row.voucherBatchNo}"吗?`, '提示', {
type: 'warning',
@@ -1329,6 +1346,9 @@ load();
color: #f56c6c;
cursor: help;
}
&__process-failed {
color: #f56c6c;
}
&__actions {
display: flex;
flex-wrap: wrap;
+6 -21
View File
@@ -1,6 +1,5 @@
<template>
<basic-container class="waybill-import-page-container">
<div class="waybill-import-page-title">导入运单</div>
<waybill-import-dialog standalone />
</basic-container>
</template>
@@ -11,28 +10,14 @@ import WaybillImportDialog from './components/waybill-import-dialog.vue';
<style scoped lang="scss">
.waybill-import-page-container {
:deep(.basic-container__card) {
background: transparent;
border: none;
box-shadow: none;
}
:deep(.basic-container__card > .el-card__body) {
padding: 0;
}
}
.waybill-import-page-title {
position: relative;
padding: 16px 24px 12px 36px;
border-bottom: 1px solid #eff1f7;
color: #303133;
font-size: 18px;
font-weight: 600;
&::before {
position: absolute;
top: 16px;
left: 24px;
width: 4px;
height: 22px;
border-radius: 2px;
background: #409eff;
content: '';
}
}
</style>
+14 -1
View File
@@ -1,9 +1,15 @@
<template>
<!--
detailId 必须做路由守卫:本组件对应 /business/waybill-manage/detail,
而 $route 是全局响应式的。标签页 keep-alive 会缓存本实例,路由切到别的详情页后
实例仍会重渲染,若无守卫就会把「当前页面的 id」灌进子组件,导致它拿别的单据 id
去查运单 → 报「运单管理不存在」,并误生成一个又一个运单详情标签。
-->
<waybill-manage-page
:api="api"
:config="config"
:crud-option="option"
:detail-id="$route.query.id"
:detail-id="detailId"
:menu-width="250"
standalone-detail-page
/>
@@ -14,10 +20,17 @@ import WaybillManagePage from './components/waybill-manage-page.vue';
import * as api from '@/api/business/waybill-manage';
import { config, option } from '@/option/business/waybill-manage';
const detailRoutePath = '/business/waybill-manage/detail';
export default {
components: { WaybillManagePage },
data() {
return { api, config, option };
},
computed: {
detailId() {
return this.$route.path === detailRoutePath ? this.$route.query.id : '';
},
},
};
</script>
@@ -0,0 +1,38 @@
<template>
<mk-public-shell biz-type="waybill-manage" :get-form="getForm">
<waybill-manage-page
ref="page"
:api="api"
:config="config"
:crud-option="option"
:detail-id="detailId"
standalone-detail-page
/>
</mk-public-shell>
</template>
<script>
import MkPublicShell from '@/views/mk/mk-public-shell.vue';
import WaybillManagePage from '@/views/business/components/waybill-manage-page.vue';
import * as api from '@/api/business/waybill-manage';
import { config, option } from '@/option/business/waybill-manage';
export default {
name: 'WaybillManagePublicView',
components: { MkPublicShell, WaybillManagePage },
data() {
return { api, config, option };
},
computed: {
detailId() {
return this.$route.query.id || '';
},
},
methods: {
getForm() {
const row = this.$refs.page?.detailRow || {};
return { ...row, subject: row.waybillNo || '' };
},
},
};
</script>
+10 -1
View File
@@ -1,9 +1,11 @@
<template>
<!-- 同 waybill-manage-detail.vue:保留旧链接 /business/waybill-manage?detailId=xxx 的能力,
但只在当前路由确实属于本页时才透传,避免被其它页面的 detailId 污染。 -->
<waybill-manage-page
:api="api"
:config="config"
:crud-option="option"
:detail-id="$route.query.detailId"
:detail-id="detailId"
:menu-width="250"
standalone-form-page
/>
@@ -14,6 +16,8 @@ import WaybillManagePage from './components/waybill-manage-page.vue';
import * as api from '@/api/business/waybill-manage';
import { config, option } from '@/option/business/waybill-manage';
const listRoutePath = '/business/waybill-manage';
export default {
components: { WaybillManagePage },
data() {
@@ -23,5 +27,10 @@ export default {
option,
};
},
computed: {
detailId() {
return this.$route.path === listRoutePath ? this.$route.query.detailId : '';
},
},
};
</script>
+155
View File
@@ -0,0 +1,155 @@
<template>
<div ref="page" class="mk-public-shell">
<slot />
</div>
</template>
<script>
import { postMkPublicProcessMessage } from '@/api/mk-process';
export default {
name: 'MkPublicShell',
props: {
bizType: {
type: String,
required: true,
},
getForm: {
type: Function,
default: null,
},
},
created() {
this.handleIframeHeight = () => this.sendIframeHeight();
this.handleProcessMessage = event => this.onProcessMessage(event);
document.addEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.addEventListener('message', this.handleProcessMessage);
},
mounted() {
document.documentElement.classList.add('mk-iframe-page');
document.body.classList.add('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.add('mk-iframe-page');
this.handleIframeHeight();
window.addEventListener('load', this.handleIframeHeight);
this.mkHeightTimers = [300, 800, 1600].map(delay => setTimeout(this.handleIframeHeight, delay));
if (typeof ResizeObserver === 'undefined') return;
this.mkHeightObserver = new ResizeObserver(() => this.handleIframeHeight());
this.$nextTick(() => {
if (this.$refs.page) this.mkHeightObserver.observe(this.$refs.page);
this.mkHeightObserver.observe(document.body);
});
},
beforeUnmount() {
document.removeEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.removeEventListener('load', this.handleIframeHeight);
window.removeEventListener('message', this.handleProcessMessage);
(this.mkHeightTimers || []).forEach(timer => clearTimeout(timer));
if (this.mkHeightObserver) {
this.mkHeightObserver.disconnect();
this.mkHeightObserver = null;
}
document.documentElement.classList.remove('mk-iframe-page');
document.body.classList.remove('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.remove('mk-iframe-page');
},
methods: {
sendIframeHeight() {
this.$nextTick(() => {
window.parent.postMessage({ height: document.body.clientHeight }, '*');
});
},
onProcessMessage(event) {
const data = event && event.data;
if (!data || typeof data !== 'object') return;
if (data.height && !data.status && !data.type) return;
if (data.type === 'formValues' || data.type === 'afterSubmit') return;
const formValues = data.formValues;
if (data.status === 'submit') {
this.submitData(formValues);
} else if (data.status === 'save') {
this.saveData(formValues);
}
if (data.type === 'getFormValues') {
window.parent.postMessage({ type: 'formValues', formData: this.buildFormData() }, '*');
}
},
submitData(lbpmFormValues) {
const formData = this.buildFormData();
this.postFormData('submit', lbpmFormValues, formData);
if (!lbpmFormValues) return;
const parameters = Object.assign({}, lbpmFormValues, {
loginName: this.getLoginName(lbpmFormValues),
formInstanceId: this.getFormId(),
subject: formData.subject,
});
window.parent.postMessage({ type: 'afterSubmit', success: true, parameters }, '*');
},
saveData(lbpmFormValues) {
this.postFormData('save', lbpmFormValues, this.buildFormData());
},
postFormData(status, formValues, formData) {
postMkPublicProcessMessage(this.bizType, {
status,
formValues: formValues || {},
formData,
}).catch(error => {
console.error('公开页提交流程数据失败:', error);
});
},
buildFormData() {
const form = this.readForm();
return {
...form,
subject: form.subject || '',
formInstanceId: this.getFormId(),
};
},
readForm() {
const form = typeof this.getForm === 'function' ? this.getForm() : {};
if (!form) return {};
try {
return JSON.parse(JSON.stringify(form));
} catch (error) {
return { ...form };
}
},
getFormId() {
return this.$route.query.id || this.readForm().id || '';
},
getLoginName(formValues = {}) {
return (
formValues.loginName ||
this.$route.query.loginName ||
this.$route.query.submitIdentity ||
''
);
},
},
};
</script>
<style lang="scss">
html.mk-iframe-page,
html.mk-iframe-page body,
html.mk-iframe-page #app,
html.mk-iframe-page #app.mk-iframe-page {
height: auto !important;
min-height: 100%;
overflow: visible;
}
</style>
<style lang="scss" scoped>
.mk-public-shell {
min-height: 100%;
padding: 12px 0 24px;
box-sizing: border-box;
background: #f0f2f5;
:deep(.basic-container) {
padding: 0 12px;
}
}
</style>
+271
View File
@@ -0,0 +1,271 @@
<template>
<div ref="page" class="mk-public-biz-view">
<basic-container>
<div class="mk-public-biz-view__title">{{ pageTitle }}</div>
<el-descriptions v-if="detail" :column="2" border>
<el-descriptions-item
v-for="item in visibleFields"
:key="item.prop"
:label="item.label"
:span="item.span || 1"
>
{{ displayValue(detail[item.prop]) }}
</el-descriptions-item>
</el-descriptions>
<el-empty v-else description="暂无数据" />
</basic-container>
</div>
</template>
<script>
import { getMkPublicDetail, postMkPublicProcessMessage } from '@/api/mk-process';
const FIELD_MAP = {
'project-apply': [
{ label: '申请单号', prop: 'applyNo' },
{ label: '项目编号', prop: 'projectCode' },
{ label: '项目名称', prop: 'projectName', span: 2 },
{ label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' },
{ label: '所属组织', prop: 'deptName' },
{ label: '备注', prop: 'remark', span: 2 },
],
'contract-manage': [
{ label: '合同编号', prop: 'contractNo' },
{ label: '合同名称', prop: 'contractName', span: 2 },
{ label: '合同类别', prop: 'contractCategory' },
{ label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' },
{ label: '甲方', prop: 'partyA' },
{ label: '乙方', prop: 'partyB' },
{ label: '项目名称', prop: 'projectName', span: 2 },
],
'waybill-manage': [
{ label: '运单号', prop: 'waybillNo' },
{ label: '项目', prop: 'projectName' },
{ label: '客户合同', prop: 'contractName' },
{ label: '客户名称', prop: 'customerName' },
{ label: '货物名称', prop: 'cargoName' },
{ label: '承运商', prop: 'carrierName' },
{ label: '当前过程节点', prop: 'currentProcessNode' },
{ label: '发货地', prop: 'departureName' },
{ label: '收货地', prop: 'arrivalName' },
],
'pre-settlement': [
{ label: '预结算单号', prop: 'preSettlementNo' },
{ label: '合同名称', prop: 'contractName' },
{ label: '项目名称', prop: 'projectName' },
{ label: '结算金额', prop: 'settlementAmount' },
{ label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' },
{ label: '备注', prop: 'remark', span: 2 },
],
'formal-settlement': [
{ label: '正式结算单号', prop: 'formalSettlementNo' },
{ label: '预结算单号', prop: 'preSettlementNos' },
{ label: '项目名称', prop: 'projectName' },
{ label: '合同名称', prop: 'contractName' },
{ label: '结算金额', prop: 'settlementAmount' },
{ label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' },
],
'payment-application': [
{ label: '付款申请号', prop: 'paymentNo' },
{ label: '付款类型', prop: 'paymentTypeName' },
{ label: '收款方', prop: 'payeeName' },
{ label: '项目名称', prop: 'projectName' },
{ label: '申请金额', prop: 'applyAmount' },
{ label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' },
],
};
const TITLE_MAP = {
'project-apply': '查看项目信息',
'contract-manage': '查看合同信息',
'waybill-manage': '查看运单信息',
'pre-settlement': '查看预结算信息',
'formal-settlement': '查看正式结算信息',
'payment-application': '查看付款申请信息',
};
export default {
name: 'MkPublicBizView',
data() {
return {
detail: null,
};
},
computed: {
bizType() {
return this.$route.meta.bizType || this.$route.query.bizType || '';
},
pageTitle() {
return TITLE_MAP[this.bizType] || '查看详情';
},
visibleFields() {
return FIELD_MAP[this.bizType] || [];
},
},
created() {
this.handleIframeHeight = () => this.sendIframeHeight();
this.handleProcessMessage = event => this.onProcessMessage(event);
document.addEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.addEventListener('message', this.handleProcessMessage);
},
mounted() {
document.documentElement.classList.add('mk-iframe-page');
document.body.classList.add('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.add('mk-iframe-page');
this.loadDetail();
this.handleIframeHeight();
window.addEventListener('load', this.handleIframeHeight);
this.mkHeightTimers = [300, 800, 1600].map(delay => setTimeout(this.handleIframeHeight, delay));
if (typeof ResizeObserver === 'undefined') return;
this.mkHeightObserver = new ResizeObserver(() => this.handleIframeHeight());
this.$nextTick(() => {
if (this.$refs.page) this.mkHeightObserver.observe(this.$refs.page);
this.mkHeightObserver.observe(document.body);
});
},
beforeUnmount() {
document.removeEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.removeEventListener('load', this.handleIframeHeight);
window.removeEventListener('message', this.handleProcessMessage);
(this.mkHeightTimers || []).forEach(timer => clearTimeout(timer));
if (this.mkHeightObserver) {
this.mkHeightObserver.disconnect();
this.mkHeightObserver = null;
}
document.documentElement.classList.remove('mk-iframe-page');
document.body.classList.remove('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.remove('mk-iframe-page');
},
methods: {
loadDetail() {
const id = this.getFormId();
if (!id || !this.bizType) return;
getMkPublicDetail(this.bizType, id).then(res => {
this.detail = res.data?.data || null;
this.handleIframeHeight();
});
},
sendIframeHeight() {
this.$nextTick(() => {
window.parent.postMessage({ height: document.body.clientHeight }, '*');
});
},
onProcessMessage(event) {
const data = event && event.data;
if (!data || typeof data !== 'object') return;
if (data.height && !data.status && !data.type) return;
if (data.type === 'formValues' || data.type === 'afterSubmit') return;
const formValues = data.formValues;
if (data.status === 'submit') {
this.submitData(formValues);
} else if (data.status === 'save') {
this.saveData(formValues);
}
if (data.type === 'getFormValues') {
window.parent.postMessage({ type: 'formValues', formData: this.buildFormData() }, '*');
}
},
submitData(lbpmFormValues) {
const formData = this.buildFormData();
this.postFormData('submit', lbpmFormValues, formData);
if (!lbpmFormValues) return;
const parameters = Object.assign({}, lbpmFormValues, {
loginName: this.getLoginName(lbpmFormValues),
formInstanceId: this.getFormId(),
subject: formData.subject,
});
window.parent.postMessage({ type: 'afterSubmit', success: true, parameters }, '*');
},
saveData(lbpmFormValues) {
this.postFormData('save', lbpmFormValues, this.buildFormData());
},
postFormData(status, formValues, formData) {
const payload = { status, formValues: formValues || {}, formData };
postMkPublicProcessMessage(this.bizType, payload).catch(error => {
console.error('公开页提交流程数据失败:', error);
});
},
buildFormData() {
const detail = this.detail || {};
return {
...detail,
id: this.getFormId() || detail.id,
subject: this.pageTitle,
formInstanceId: this.getFormId(),
};
},
getFormId() {
return this.$route.query.id || this.detail?.id || '';
},
getLoginName(formValues = {}) {
return (
formValues.loginName ||
this.$route.query.loginName ||
this.$route.query.submitIdentity ||
''
);
},
displayValue(value) {
if (value === null || value === undefined || value === '') return '-';
if (Array.isArray(value)) return value.join('、') || '-';
if (typeof value === 'object') return JSON.stringify(value);
return value;
},
},
};
</script>
<style lang="scss">
html.mk-iframe-page,
html.mk-iframe-page body,
html.mk-iframe-page #app,
html.mk-iframe-page #app.mk-iframe-page {
height: auto !important;
min-height: 100%;
overflow: visible;
}
</style>
<style lang="scss" scoped>
.mk-public-biz-view {
min-height: 100%;
padding: 12px 0 24px;
box-sizing: border-box;
background: #f0f2f5;
:deep(.basic-container) {
padding: 0 12px;
}
&__title {
position: relative;
padding-left: 12px;
margin: 8px 0 16px;
font-size: 16px;
font-weight: 600;
line-height: 22px;
&::before {
content: '';
position: absolute;
left: 0;
top: 2px;
width: 4px;
height: 18px;
background: #409eff;
}
}
}
</style>
@@ -888,7 +888,7 @@ export default {
item.receiverName !== first.receiverName
);
if (incompatible) {
this.$message.warning('合并开票的结算单必须属于同一合同、项目、组织及收付款方');
this.$message.warning('合并开票的结算单必须属于同一合同');
return;
}
this.form.settlements = rows.map(item => ({
@@ -1267,7 +1267,7 @@ export default {
}
.invoice-form-page__dialog-search {
display: flex;
justify-content: flex-end;
justify-content: flex-start;
gap: 8px;
margin-bottom: 12px;
}
+1 -1
View File
@@ -167,7 +167,7 @@
<el-input
v-model="settlementDialog.keyword"
clearable
placeholder="结算单号、项目或合同"
placeholder="3结算单号、项目或合同"
@keyup.enter="loadSettlementCandidates"
/>
<el-button type="primary" @click="loadSettlementCandidates">查询</el-button>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,21 @@
<template>
<mk-public-shell biz-type="payment-application" :get-form="getForm">
<payment-application-form ref="page" />
</mk-public-shell>
</template>
<script>
import MkPublicShell from '@/views/mk/mk-public-shell.vue';
import PaymentApplicationForm from '@/views/payment/payment-application-form.vue';
export default {
name: 'PaymentApplicationPublicView',
components: { MkPublicShell, PaymentApplicationForm },
methods: {
getForm() {
const form = this.$refs.page?.form || {};
return { ...form, subject: form.paymentNo || form.projectName || '' };
},
},
};
</script>
+8 -1
View File
@@ -240,6 +240,7 @@ import { mapGetters } from 'vuex';
import * as api from '@/api/payment/paymentApplication';
import { paymentApplicationTableColumns } from '@/option/payment/paymentApplication';
import organizationSearch from '@/mixins/organization-search';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
const emptyQuery = () => ({
paymentNo: '',
@@ -332,7 +333,7 @@ export default {
openProjectAdvance() {
this.$router.push({
path: '/payment/payment-application/form',
query: { mode: 'add', paymentType: 'project_advance' },
query: { mode: 'add', paymentType: 'progress_advance' },
});
},
openEdit(row) {
@@ -368,6 +369,12 @@ export default {
},
async handleSubmit(row) {
await api.submit({ id: row.id });
await submitMkApprovalFlow({
bizType: 'payment-application',
formInstanceId: row.id,
subjectName: row.paymentNo || '',
approvalStatus: row.approvalStatus || '',
});
this.$message.success('提交成功');
this.loadTable();
},
@@ -212,8 +212,15 @@
</el-button>
</el-form-item>
</el-form>
<el-table v-show="!detailCollapsed" :data="filteredDetails" border>
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
<el-table v-show="!detailCollapsed" :data="pagedDetails" border>
<el-table-column
type="index"
label="序号"
width="64"
fixed="left"
align="center"
:index="detailIndexMethod"
/>
<el-table-column
v-for="column in detailTableColumns"
:key="column.prop"
@@ -246,6 +253,16 @@
</template>
</el-table-column>
</el-table>
<div v-show="!detailCollapsed" class="formal-editor__pagination">
<el-pagination
v-model:current-page="detailPage.current"
v-model:page-size="detailPage.size"
:total="filteredDetails.length"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleDetailPageSizeChange"
/>
</div>
</section-card>
<section-card>
@@ -573,7 +590,7 @@
>提交</el-button
>
</template>
<div v-if="pageMode" class="formal-editor__page-actions">
<div v-if="pageMode && !publicMode" class="formal-editor__page-actions">
<el-button @click="visible = false">取消</el-button>
<el-button
v-if="editable && !recordId"
@@ -879,6 +896,7 @@
</template>
<script>
import { getMkPublicDetail } from '@/api/mk-process';
import {
adjustDetail,
getCandidateDetails,
@@ -930,6 +948,10 @@ export default {
type: Object,
default: null,
},
publicMode: {
type: Boolean,
default: false,
},
},
emits: ['update:modelValue', 'success'],
data() {
@@ -1038,6 +1060,10 @@ export default {
batchNo: '',
cargoName: '',
},
detailPage: {
current: 1,
size: 10,
},
};
},
computed: {
@@ -1085,6 +1111,13 @@ export default {
})
);
},
pagedDetails() {
const list = this.filteredDetails;
const size = Number(this.detailPage.size) || 10;
const current = Math.max(Number(this.detailPage.current) || 1, 1);
const start = (current - 1) * size;
return list.slice(start, start + size);
},
missingAttachmentTypeText() {
const missing = this.getMissingAttachmentTypes();
return missing.length ? `未上传:${missing.join('、')}` : '';
@@ -1104,6 +1137,16 @@ export default {
if (value) this.initialize();
},
},
filteredDetails: {
handler(list) {
const size = Number(this.detailPage.size) || 10;
const maxPage = Math.max(1, Math.ceil((list?.length || 0) / size) || 1);
if (this.detailPage.current > maxPage) {
this.detailPage.current = maxPage;
}
},
immediate: true,
},
summaryTotal(value) {
this.form.settlementAmount = Number(value || 0).toFixed(2);
this.form.localSettlementAmount = (
@@ -1118,7 +1161,9 @@ export default {
},
methods: {
async loadFormalDetail(id) {
const response = await getDetail(id);
const response = this.publicMode
? await getMkPublicDetail('formal-settlement', id)
: await getDetail(id);
const data = this.unwrapData(response);
this.form = {
...createFormalSettlementForm(),
@@ -1130,12 +1175,13 @@ export default {
};
this.sources = data.sources || [];
this.details = data.details || [];
this.detailPage.current = 1;
this.summaryFees = data.summaryFees || [];
// 服务端数据已刷新,费用快照与暂存调整全部作废。
this.detailFeeSnapshots = {};
this.pendingAdjustments = {};
this.paymentApplications = data.paymentApplications || [];
if (this.readonly && this.form.settlementType === 'receivable') {
if (this.readonly && this.form.settlementType === 'receivable' && !this.publicMode) {
this.receiptClaims = this.unwrapData(await getReceiptClaims(id)) || [];
}
this.adjustments = data.adjustments || [];
@@ -1181,14 +1227,17 @@ export default {
rule: null,
};
this.detailCollapsed = false;
this.detailPage = { current: 1, size: 10 };
this.resetDetailQuery(false);
await Promise.all([
this.loadAllContracts(),
this.loadFeeOptions(),
this.loadFeeCategoryOptions(),
this.loadAttachmentTypeOptions(),
this.loadTransportTypeOptions(),
]);
if (!this.publicMode) {
await Promise.all([
this.loadAllContracts(),
this.loadFeeOptions(),
this.loadFeeCategoryOptions(),
this.loadAttachmentTypeOptions(),
this.loadTransportTypeOptions(),
]);
}
if (!this.recordId) {
this.form.exchangeRateDate = this.$dayjs().format('YYYY-MM-DD');
if (this.initialData) await this.applyInitialData();
@@ -1273,6 +1322,7 @@ export default {
settlementAmountTax:
row.settlementAmountTax ?? row.totalAmount ?? row.afterAmount ?? row.settlementAmount,
}));
this.detailPage.current = 1;
this.form.sourceDetailIds = this.details.map(item => item.sourceDetailId);
await this.refreshSummaryFees();
},
@@ -1318,6 +1368,7 @@ export default {
sourcePreSettlementId: settlement.id,
}))
);
this.detailPage.current = 1;
const summaryMap = new Map();
settlements
.flatMap(settlement => settlement.summaryFees || [])
@@ -1564,6 +1615,7 @@ export default {
...this.details.filter(item => item.formalSettlementId),
...existing.values(),
];
this.detailPage.current = 1;
this.form.sourceDetailIds = [...existing.values()].map(item => item.sourceDetailId);
this.detailCandidate.loading = true;
try {
@@ -1782,6 +1834,9 @@ export default {
return sourceDetailId ? `src:${sourceDetailId}` : '';
},
async loadDetailFeeRows(detail) {
if (this.publicMode) {
return [this.normalizeAdjustRow(detail)];
}
if (detail.formalSettlementId && detail.id) {
const rows = this.unwrapData(await getDetailFees(detail.id)) || [];
return rows.map(item => this.normalizeAdjustRow(item));
@@ -1883,12 +1938,19 @@ export default {
},
handleDetailQuery() {
this.appliedDetailQuery = { ...this.detailQuery };
this.detailPage.current = 1;
},
resetDetailQuery(apply = true) {
this.detailQuery = { documentNo: '', waybillNo: '', batchNo: '', cargoName: '' };
if (apply) this.handleDetailQuery();
else this.appliedDetailQuery = { ...this.detailQuery };
},
handleDetailPageSizeChange() {
this.detailPage.current = 1;
},
detailIndexMethod(index) {
return (this.detailPage.current - 1) * this.detailPage.size + index + 1;
},
exportDetails() {
if (!this.details.length) return this.$message.warning('暂无可导出的结算明细');
const rows = this.details.map((row, index) => {
@@ -66,6 +66,12 @@
<span v-else-if="field.prop === 'settlementType'" class="form-readonly">
{{ settlementTypeName }}
</span>
<span v-else-if="field.prop === 'preSettlementNo'" class="form-readonly">
{{ form.preSettlementNo || (!form.id ? '系统自动生成' : '-') }}
</span>
<span v-else-if="field.prop === 'createTime'" class="form-readonly">
{{ formatCreateDate(form.createTime) }}
</span>
<span v-else-if="field.money" class="form-readonly">
{{ formatMoney(form[field.prop], moneyCurrency(field.prop)) }}
</span>
@@ -184,7 +190,6 @@
</template>
<el-form
:model="detailQuery"
inline
label-position="right"
label-width="auto"
class="pre-settlement-editor__detail-filter"
@@ -228,8 +233,15 @@
</el-form-item>
</el-form>
<div v-show="!detailCollapsed">
<el-table :data="filteredDetails" border class="pre-settlement-editor__detail-table">
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
<el-table :data="pagedDetails" border class="pre-settlement-editor__detail-table">
<el-table-column
type="index"
label="序号"
width="64"
fixed="left"
align="center"
:index="detailIndexMethod"
/>
<el-table-column
v-for="column in visibleDetailColumns"
:key="column.prop"
@@ -300,6 +312,16 @@
</template>
</el-table-column>
</el-table>
<div class="pre-settlement-editor__pagination">
<el-pagination
v-model:current-page="detailPage.current"
v-model:page-size="detailPage.size"
:total="filteredDetails.length"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleDetailPageSizeChange"
/>
</div>
</div>
</section-card>
@@ -313,13 +335,43 @@
<el-table :data="attachments" border @selection-change="handleAttachmentSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column label="文件名" min-width="260" show-overflow-tooltip>
<el-table-column label="附件类型" min-width="180" align="center">
<template #default="{ row }">
<el-select
v-if="editable"
v-model="row.type"
filterable
placeholder="请选择"
@change="sortAttachments"
>
<el-option
v-for="item in attachmentTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<span v-else>{{ attachmentTypeName(row.type) }}</span>
</template>
</el-table-column>
<el-table-column label="文件名称" min-width="260" show-overflow-tooltip>
<template #default="{ row }">
<el-link type="primary" @click="previewAttachment(row)">
{{ attachmentName(row) }}
</el-link>
</template>
</el-table-column>
<el-table-column label="附件描述" min-width="220">
<template #default="{ row }">
<span v-if="!editable">{{ row.description || '-' }}</span>
<el-input
v-else
v-model="row.description"
maxlength="200"
placeholder="请输入"
/>
</template>
</el-table-column>
<el-table-column label="文件大小" width="120" align="center">
<template #default="{ row }">{{ formatFileSize(row.size) }}</template>
</el-table-column>
@@ -425,7 +477,7 @@
提交
</el-button>
</template>
<div v-if="pageMode" class="pre-settlement-editor__page-actions">
<div v-if="pageMode && !publicMode" class="pre-settlement-editor__page-actions">
<el-button @click="visible = false">取消</el-button>
<el-button v-if="editable" type="primary" plain :loading="saving" @click="saveDraft(false)"
>保存</el-button
@@ -681,134 +733,113 @@
append-to-body
destroy-on-close
>
<el-tabs v-model="adjustDialog.activeTab" class="pre-settlement-editor__adjust-tabs">
<el-tab-pane label="结算明细调整" name="adjust">
<el-table v-loading="adjustDialog.loading" :data="adjustRows" border>
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
<el-table-column prop="cargoName" label="货物名称" min-width="140" align="center" />
<el-table-column prop="cargoType" label="货物类型" min-width="130" align="center" />
<el-table-column label="计费规则" min-width="190" align="center">
<template #default="{ row }">
<div class="pre-settlement-editor__billing-rule-cell">
<span>{{ displayValue(billingRuleName(row)) }}</span>
<el-icon
class="pre-settlement-editor__billing-rule-icon"
title="查看计费规则详情"
@click="openBillingRuleInfo(row)"
>
<InfoFilled />
</el-icon>
</div>
</template>
</el-table-column>
<el-table-column label="运输总量" min-width="150" align="center">
<template #default="{ row }">
<span v-if="adjustDialog.readonly">{{ formatQuantity(row) }}</span>
<el-input-number
v-else
v-model="row.transportQuantity"
:min="0"
:precision="2"
:controls="false"
@change="recalculateAdjustRow(row, 'transportQuantity')"
/>
</template>
</el-table-column>
<el-table-column label="里程(KM)" min-width="140" align="center">
<template #default="{ row }">
<el-input-number
v-model="row.mileage"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@change="recalculateAdjustRow(row, 'mileage')"
/>
</template>
</el-table-column>
<el-table-column label="运输单价" min-width="140" align="center">
<template #default="{ row }">
<el-input-number
v-model="row.unitPrice"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@change="recalculateAdjustRow(row, 'unitPrice')"
/>
</template>
</el-table-column>
<el-table-column
v-for="feeItem in adjustFeeItemNames"
:key="feeItem"
:label="feeItem"
min-width="140"
align="center"
>
<template #default="{ row }">
<el-input-number
v-model="row.feeItems[feeItem]"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@change="recalculateAdjustRow(row, feeItem)"
/>
</template>
</el-table-column>
<el-table-column label="结算金额(含税)" min-width="170" align="center">
<template #default="{ row }">
<el-input-number
v-model="row.settlementAmountTax"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
/>
</template>
</el-table-column>
<el-table-column label="备注" min-width="200" align="center">
<template #default="{ row }">
<el-input v-model="row.remark" maxlength="200" :disabled="adjustDialog.readonly" />
</template>
</el-table-column>
</el-table>
<el-form
v-if="!adjustDialog.readonly"
:model="adjustDialog"
label-position="right"
label-width="auto"
class="pre-settlement-editor__adjust-reason"
>
<el-form-item label="调整原因">
<el-input v-model="adjustDialog.reason" maxlength="200" show-word-limit />
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane label="变更记录" name="records">
<el-table :data="changeRecords" border>
<el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column prop="changeTime" label="变更日期" min-width="170" align="center" />
<el-table-column prop="operatorName" label="经办人" min-width="140" align="center" />
<el-table-column prop="changeType" label="变更类型" min-width="160" align="center" />
<el-table-column
prop="changeReason"
label="变更原因"
min-width="240"
align="center"
show-overflow-tooltip
<el-table v-loading="adjustDialog.loading" :data="adjustRows" border>
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
<el-table-column prop="cargoName" label="货物名称" min-width="140" align="center" />
<el-table-column prop="cargoType" label="货物类型" min-width="130" align="center" />
<el-table-column label="计费规则" min-width="190" align="center">
<template #default="{ row }">
<div class="pre-settlement-editor__billing-rule-cell">
<span>{{ displayValue(billingRuleName(row)) }}</span>
<el-icon
class="pre-settlement-editor__billing-rule-icon"
title="查看计费规则详情"
@click="openBillingRuleInfo(row)"
>
<InfoFilled />
</el-icon>
</div>
</template>
</el-table-column>
<el-table-column label="运输总量" min-width="150" align="center">
<template #default="{ row }">
<span v-if="adjustDialog.readonly">{{ formatQuantity(row) }}</span>
<el-input-number
v-else
v-model="row.transportQuantity"
:min="0"
:precision="2"
:controls="false"
@change="recalculateAdjustRow(row, 'transportQuantity')"
/>
<el-table-column label="状态" min-width="120" align="center">
<template #default>已生效</template>
</el-table-column>
<el-table-column label="操作" width="120" align="center" fixed="right">
<template #default="{ row }">
<el-link type="primary" @click="openAdjustChangeRecord(row)">查看详情</el-link>
</template>
</el-table-column>
</el-table>
<el-empty v-if="!adjustChangeRecords.length" description="暂无变更记录" :image-size="60" />
</el-tab-pane>
</el-tabs>
</template>
</el-table-column>
<el-table-column label="里程(KM)" min-width="140" align="center">
<template #default="{ row }">
<el-input-number
v-model="row.mileage"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@change="recalculateAdjustRow(row, 'mileage')"
/>
</template>
</el-table-column>
<el-table-column label="运输单价" min-width="140" align="center">
<template #default="{ row }">
<el-input-number
v-model="row.unitPrice"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@change="recalculateAdjustRow(row, 'unitPrice')"
/>
</template>
</el-table-column>
<el-table-column
v-for="feeItem in adjustFeeItemNames"
:key="feeItem"
:label="feeItem"
min-width="140"
align="center"
>
<template #default="{ row }">
<el-input-number
v-model="row.feeItems[feeItem]"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@change="recalculateAdjustRow(row, feeItem)"
/>
</template>
</el-table-column>
<el-table-column label="结算金额(含税)" min-width="170" align="center">
<template #default="{ row }">
<el-input-number
v-model="row.settlementAmountTax"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
/>
</template>
</el-table-column>
<el-table-column label="备注" min-width="200" align="center">
<template #default="{ row }">
<el-input v-model="row.remark" maxlength="200" :disabled="adjustDialog.readonly" />
</template>
</el-table-column>
</el-table>
<el-form
v-if="!adjustDialog.readonly"
:model="adjustDialog"
label-position="right"
label-width="auto"
class="pre-settlement-editor__adjust-reason"
>
<el-form-item label="调整原因">
<el-input
v-model="adjustDialog.reason"
type="textarea"
:rows="2"
maxlength="200"
show-word-limit
placeholder="请输入"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="adjustDialog.visible = false">取消</el-button>
<el-button
@@ -822,35 +853,10 @@
</template>
</el-dialog>
<el-dialog
<change-record-detail-dialog
v-model="adjustChangeRecordVisible"
title="变更记录详情"
append-to-body
destroy-on-close
width="1100px"
top="10px"
class="pre-settlement-change-record-detail-dialog"
>
<div v-if="adjustChangeRecord" class="pre-settlement-change-record-detail-meta">
<span>变更日期:{{ adjustChangeRecord.changeTime || '-' }}</span>
<span>经办人:{{ adjustChangeRecord.operatorName || '-' }}</span>
<span>变更类型:{{ adjustChangeRecord.changeType || '-' }}</span>
<span>状态:已生效</span>
</div>
<el-table :data="adjustChangeRecordDetailRows" border :show-overflow-tooltip="false">
<el-table-column prop="field" label="变更字段" min-width="220" />
<el-table-column prop="before" label="变更前" min-width="330" />
<el-table-column prop="after" label="变更后" min-width="420" />
</el-table>
<el-empty
v-if="!adjustChangeRecordDetailRows.length"
description="暂无变更内容"
:image-size="60"
/>
<template #footer>
<el-button type="primary" @click="adjustChangeRecordVisible = false">关闭</el-button>
</template>
</el-dialog>
:rows="adjustChangeRecordDetailRows"
/>
<el-dialog
v-model="billingRuleDialog.visible"
@@ -922,6 +928,8 @@
import { h } from 'vue';
import { mapGetters } from 'vuex';
import { InfoFilled } from '@element-plus/icons-vue';
import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue';
import { getMkPublicDetail } from '@/api/mk-process';
import {
adjustDetail,
getCandidateDetails,
@@ -956,11 +964,12 @@ import {
settlementSummaryColumns,
} from '@/option/settlement/preSettlementTable';
import { downloadFileByUrl } from '@/utils/util';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
import * as XLSX from 'xlsx';
export default {
name: 'PreSettlementEditor',
components: { InfoFilled },
components: { InfoFilled, ChangeRecordDetailDialog },
props: {
modelValue: {
type: Boolean,
@@ -982,6 +991,10 @@ export default {
type: Object,
default: null,
},
publicMode: {
type: Boolean,
default: false,
},
},
emits: ['update:modelValue', 'success'],
data() {
@@ -1054,9 +1067,14 @@ export default {
batchNo: '',
cargoName: '',
},
detailPage: {
current: 1,
size: 10,
},
advances: [],
changeRecords: [],
attachments: [],
attachmentTypeOptions: [],
selectedAttachmentRows: [],
candidateDialog: {
visible: false,
@@ -1079,7 +1097,6 @@ export default {
loading: false,
saving: false,
readonly: false,
activeTab: 'adjust',
detailId: '',
sourceDetailId: '',
detailLineNo: '',
@@ -1206,6 +1223,13 @@ export default {
})
);
},
pagedDetails() {
const list = this.filteredDetails;
const size = Number(this.detailPage.size) || 10;
const current = Math.max(Number(this.detailPage.current) || 1, 1);
const start = (current - 1) * size;
return list.slice(start, start + size);
},
adjustFeeItemNames() {
const names = new Set();
this.adjustRows.forEach(row => {
@@ -1232,6 +1256,16 @@ export default {
this.form.settlementAmount = Number(value || 0).toFixed(2);
this.recalculateLocalAmount();
},
filteredDetails: {
handler(list) {
const size = Number(this.detailPage.size) || 10;
const maxPage = Math.max(1, Math.ceil((list?.length || 0) / size) || 1);
if (this.detailPage.current > maxPage) {
this.detailPage.current = maxPage;
}
},
immediate: true,
},
},
methods: {
hasPermission(code) {
@@ -1239,9 +1273,12 @@ export default {
},
async initialize() {
this.resetEditor();
await this.loadFeeOptions();
await this.loadFeeCategoryOptions();
await this.loadTransportTypeOptions();
if (!this.publicMode) {
await this.loadFeeOptions();
await this.loadFeeCategoryOptions();
await this.loadTransportTypeOptions();
await this.loadAttachmentTypeOptions();
}
if (this.recordId) await this.loadDetail();
else if (this.initialData) {
await this.applyInitialData();
@@ -1285,6 +1322,7 @@ export default {
localCurrency: first.localCurrency || 'RMB',
});
this.details = rows.map(row => this.normalizeSourceDetail(row));
this.detailPage.current = 1;
this.loading = true;
try {
await this.ensureSourceFeeSnapshots();
@@ -1346,6 +1384,7 @@ export default {
cargoName: '',
};
this.appliedDetailQuery = { ...this.detailQuery };
this.detailPage = { current: 1, size: 10 };
this.advances = [];
this.changeRecords = [];
this.attachments = [];
@@ -1354,7 +1393,6 @@ export default {
this.pendingAdjustments = {};
this.sourceFeeSnapshots = {};
this.detailFeeCache = {};
this.adjustDialog.activeTab = 'adjust';
this.adjustDialog.detailId = '';
this.adjustDialog.sourceDetailId = '';
this.adjustDialog.detailLineNo = '';
@@ -1374,11 +1412,14 @@ export default {
async loadDetail() {
this.loading = true;
try {
const { data } = await getDetail(this.form.id || this.recordId);
const detail = data?.data || {};
const response = this.publicMode
? await getMkPublicDetail('pre-settlement', this.form.id || this.recordId)
: await getDetail(this.form.id || this.recordId);
const detail = response.data?.data || {};
this.form = { ...emptyPreSettlementForm(), ...detail };
this.summaryFees = (detail.summaryFees || []).map(row => ({ ...row }));
this.details = (detail.details || []).map(row => this.normalizeSourceDetail(row));
this.detailPage.current = 1;
this.advances = (detail.advances || []).map(row => ({
...row,
createUserName: row.createUserName || detail.createUserName,
@@ -1386,6 +1427,7 @@ export default {
}));
this.changeRecords = detail.changeRecords || [];
this.attachments = this.parseAttachments(detail.attachmentsJson);
this.sortAttachments();
this.selectedAttachmentRows = [];
if (
detail.contractId &&
@@ -1403,8 +1445,15 @@ export default {
partyB: detail.payeeName,
});
}
// 预加载所有明细的费用明细数据,用于拼接货物名称和类型
await this.loadAllDetailFees();
if (this.publicMode && detail.detailFees) {
Object.entries(detail.detailFees).forEach(([detailId, feeRows]) => {
if (Array.isArray(feeRows) && feeRows.length) {
this.detailFeeCache[detailId] = feeRows;
}
});
} else {
await this.loadAllDetailFees();
}
} finally {
this.loading = false;
}
@@ -1563,12 +1612,19 @@ export default {
await this.persistPendingAdjustments();
if (shouldSubmit) {
await submit({ id: this.form.id });
await submitMkApprovalFlow({
bizType: 'pre-settlement',
formInstanceId: this.form.id,
subjectName: this.form.preSettlementNo || this.form.contractName || '',
approvalStatus: this.form.approvalStatus || '',
});
this.$message.success('审批流程已发起');
this.visible = false;
this.$emit('success', this.form.id);
return;
}
this.$message.success('保存成功');
this.visible = false;
this.$emit('success', this.form.id);
} finally {
this[stateKey] = false;
@@ -1918,6 +1974,7 @@ export default {
},
handleDetailQuery() {
this.appliedDetailQuery = { ...this.detailQuery };
this.detailPage.current = 1;
},
resetDetailQuery() {
this.detailQuery = {
@@ -1927,6 +1984,13 @@ export default {
cargoName: '',
};
this.appliedDetailQuery = { ...this.detailQuery };
this.detailPage.current = 1;
},
handleDetailPageSizeChange() {
this.detailPage.current = 1;
},
detailIndexMethod(index) {
return (this.detailPage.current - 1) * this.detailPage.size + index + 1;
},
normalizeAdjustRow(item, feeItemNames = []) {
const rawFeeItems =
@@ -2049,7 +2113,6 @@ export default {
this.adjustDialog.visible = true;
this.adjustDialog.loading = true;
this.adjustDialog.readonly = readonly;
this.adjustDialog.activeTab = 'adjust';
this.adjustDialog.detailId = detailRow.id;
this.adjustDialog.detailLineNo = detailRow.lineNo;
this.adjustDialog.sourceDetailId =
@@ -2065,6 +2128,11 @@ export default {
this.adjustRows = this.cloneAdjustRows(pending.rows);
return;
}
if (this.publicMode) {
const cachedFees = this.detailFeeCache[detailRow.id] || [];
this.adjustRows = cachedFees.map(item => this.normalizeAdjustRow(item));
return;
}
if (sourceDetailId) {
if (!this.sourceFeeSnapshots[sourceDetailId]) {
this.sourceFeeSnapshots[sourceDetailId] = await this.loadSourceFeeRows(sourceDetailId);
@@ -2072,6 +2140,11 @@ export default {
this.adjustRows = this.cloneAdjustRows(this.sourceFeeSnapshots[sourceDetailId]);
return;
}
const cachedFees = this.detailFeeCache[detailRow.id];
if (this.publicMode && Array.isArray(cachedFees)) {
this.adjustRows = cachedFees.map(item => this.normalizeAdjustRow(item));
return;
}
const response = await getDetailFees(detailRow.id);
const rows = response.data?.data || response.data || [];
this.adjustRows = rows.map(item => this.normalizeAdjustRow(item));
@@ -2260,10 +2333,6 @@ export default {
return String(name || '').includes('运费') || String(name || '').includes('运输费');
},
async saveAdjustment() {
if (!this.adjustDialog.reason.trim()) {
this.$message.warning('请输入调整原因');
return;
}
if (this.adjustRows.some(row => row.calculating)) {
this.$message.warning('费用正在重新计算,请稍候');
return;
@@ -2442,13 +2511,92 @@ export default {
handleAttachmentChange(list) {
const uploadUserName = this.userInfo?.realName || this.userInfo?.userName || '';
const uploadTime = this.$dayjs().format('YYYY-MM-DD HH:mm:ss');
this.attachments = (list || []).map(file => ({
...file,
uploadUserName: file.uploadUserName || uploadUserName,
uploadTime: file.uploadTime || uploadTime,
}));
const existingRows = this.attachments || [];
this.attachments = (list || []).map(file => {
const fileUrl = this.attachmentUrl(file);
const existing = existingRows.find(item => {
const sameUid = file.uid && item.uid && String(file.uid) === String(item.uid);
const sameUrl = fileUrl && this.attachmentUrl(item) === fileUrl;
return sameUid || sameUrl;
});
const originalName = this.attachmentName(file);
return {
...file,
type: existing?.type || file.type || this.resolveAttachmentType(originalName),
description: existing?.description || file.description || '',
uploadUserName: existing?.uploadUserName || file.uploadUserName || uploadUserName,
uploadTime: existing?.uploadTime || file.uploadTime || uploadTime,
};
});
this.sortAttachments();
this.selectedAttachmentRows = [];
},
async loadAttachmentTypeOptions() {
try {
const response = await getDictionary({ code: 'pre_settlement_attachment_type' });
const data = response?.data?.data || [];
this.attachmentTypeOptions = data
.map(item => ({
label: item.dictValue,
value: item.dictValue,
}))
.filter(item => item.label && item.value);
} catch (error) {
this.attachmentTypeOptions = [];
}
this.sortAttachments();
},
resolveAttachmentType(fileName) {
const normalizedName = String(fileName || '').toLocaleLowerCase();
const matchedType = [...this.attachmentTypeOptions]
.filter(item => item?.label || item?.value)
.sort(
(a, b) =>
String(b.label || b.value || '').length - String(a.label || a.value || '').length
)
.find(item => {
const typeText = String(item.label || item.value || '').toLocaleLowerCase();
return typeText && normalizedName.includes(typeText);
});
if (matchedType?.value) return matchedType.value;
const otherType = this.attachmentTypeOptions.find(item => this.isOtherAttachmentType(item));
if (otherType?.value) return otherType.value;
return '';
},
isOtherAttachmentType(item) {
const typeText = String(item?.label || item?.value || '').trim();
return (
typeText === '其他' ||
typeText === '其它' ||
typeText === '其他附件' ||
typeText === '其它附件'
);
},
getAttachmentTypeOrder(type) {
const normalizedType = String(type || '').trim();
const index = this.attachmentTypeOptions.findIndex(
item =>
String(item.value || '').trim() === normalizedType ||
String(item.label || '').trim() === normalizedType
);
return index === -1 ? Number.MAX_SAFE_INTEGER : index;
},
sortAttachments() {
this.attachments = (this.attachments || [])
.map((file, index) => ({ file, index }))
.sort((a, b) => {
const orderDifference =
this.getAttachmentTypeOrder(a.file.type) - this.getAttachmentTypeOrder(b.file.type);
return orderDifference || a.index - b.index;
})
.map(item => item.file);
},
attachmentTypeName(type) {
const option = this.attachmentTypeOptions.find(
item => String(item.value) === String(type) || String(item.label) === String(type)
);
return option?.label || type || '-';
},
handleAttachmentSelectionChange(rows) {
this.selectedAttachmentRows = rows || [];
},
@@ -2492,13 +2640,25 @@ export default {
},
parseAttachments(value) {
if (!value) return [];
if (Array.isArray(value)) return value;
try {
const parsed = JSON.parse(value);
return Array.isArray(parsed) ? parsed : [];
} catch (error) {
return [];
let list = [];
if (Array.isArray(value)) {
list = value;
} else {
try {
const parsed = JSON.parse(value);
list = Array.isArray(parsed) ? parsed : [];
} catch (error) {
return [];
}
}
return list.map(file => {
const originalName = this.attachmentName(file);
return {
...file,
type: file?.type || this.resolveAttachmentType(originalName),
description: file?.description || '',
};
});
},
parseFeeItems(value) {
if (!value) return {};
@@ -2535,6 +2695,11 @@ export default {
if (!Number.isFinite(amount)) return '-';
return `${amount.toFixed(2)} ${currency || 'RMB'}`;
},
formatCreateDate(value) {
if (value === undefined || value === null || value === '') return '-';
const parsed = this.$dayjs(value);
return parsed.isValid() ? parsed.format('YYYY-MM-DD') : this.displayValue(value);
},
formatQuantity(row) {
const value = row.transportQuantity;
if (value === undefined || value === null || value === '') return '-';
@@ -2685,22 +2850,43 @@ export default {
}
&__detail-filter {
display: flex;
flex-wrap: wrap;
gap: 0 24px;
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
align-items: center;
gap: 8px 16px;
margin-bottom: 12px;
padding: 12px 12px 4px;
background: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
:deep(.el-form-item) {
display: flex;
min-width: 0;
margin-right: 0;
margin-bottom: 0;
}
:deep(.el-form-item__content) {
flex: 1;
min-width: 0;
}
:deep(.el-input) {
width: 220px;
width: 100%;
}
}
&__detail-filter-actions {
margin-left: auto;
width: auto;
margin-left: 0;
white-space: nowrap;
justify-self: end;
:deep(.el-form-item__content) {
flex: none;
justify-content: flex-end;
flex-wrap: nowrap;
}
}
&__contract-filter {
@@ -2813,23 +2999,6 @@ export default {
}
}
.pre-settlement-change-record-detail-meta {
display: flex;
flex-wrap: wrap;
gap: 8px 32px;
margin-bottom: 16px;
color: #606266;
}
:deep(.pre-settlement-change-record-detail-dialog .el-dialog__body) {
padding-top: 12px;
}
:deep(.pre-settlement-change-record-detail-dialog .el-table .cell) {
white-space: pre-wrap;
word-break: break-all;
}
:deep(.pre-settlement-editor .el-dialog__body) {
padding: 12px 16px;
}
@@ -56,6 +56,7 @@ export default {
methods: {
goBack() {
removeSettlementTransfer(this.$route.query.transferToken);
this.$router.$avueRouter.closeTag();
this.$router.push('/settlement/formal-settlement');
},
syncTagTitle() {
@@ -0,0 +1,55 @@
<template>
<mk-public-shell biz-type="formal-settlement" :get-form="getForm">
<basic-container>
<div class="mk-public-form-title">查看正式结算</div>
<formal-settlement-editor
ref="page"
:model-value="true"
page-mode
readonly
public-mode
:record-id="recordId"
/>
</basic-container>
</mk-public-shell>
</template>
<script>
import MkPublicShell from '@/views/mk/mk-public-shell.vue';
import FormalSettlementEditor from '@/views/settlement/components/formal-settlement-editor.vue';
export default {
name: 'FormalSettlementPublicView',
components: { MkPublicShell, FormalSettlementEditor },
computed: {
recordId() {
return this.$route.query.id || '';
},
},
methods: {
getForm() {
const form = this.$refs.page?.form || {};
return { ...form, subject: form.formalSettlementNo || form.contractName || '' };
},
},
};
</script>
<style lang="scss" scoped>
.mk-public-form-title {
display: flex;
align-items: center;
min-height: 24px;
margin-bottom: 16px;
font-size: 18px;
font-weight: 600;
&::before {
width: 4px;
height: 20px;
margin-right: 8px;
background: #409eff;
content: '';
}
}
</style>
@@ -182,6 +182,7 @@ import organizationSearch from '@/mixins/organization-search';
import { formalSettlementTableColumns } from '@/option/settlement/formalSettlementTable';
import FormalSettlementEditor from './components/formal-settlement-editor.vue';
import FormalSettlementTablePanel from './components/formal-settlement-table-panel.vue';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
const emptyQuery = () => ({
formalSettlementNo: '',
@@ -337,6 +338,12 @@ export default {
async handleSubmit(row) {
await this.$confirm('提交后来源预结算将保持锁定,确认提交?', '提示', { type: 'warning' });
await api.submit({ id: row.id });
await submitMkApprovalFlow({
bizType: 'formal-settlement',
formInstanceId: row.id,
subjectName: row.formalSettlementNo || '',
approvalStatus: row.approvalStatus || '',
});
this.$message.success('提交成功');
this.loadTable();
},
@@ -50,6 +50,7 @@ export default {
},
goBack() {
removeSettlementTransfer(this.$route.query.transferToken);
this.$router.$avueRouter.closeTag();
this.$router.push('/settlement/pre-settlement');
},
syncTagTitle() {
@@ -0,0 +1,55 @@
<template>
<mk-public-shell biz-type="pre-settlement" :get-form="getForm">
<basic-container>
<div class="mk-public-form-title">查看预结算</div>
<pre-settlement-editor
ref="page"
:model-value="true"
page-mode
readonly
public-mode
:record-id="recordId"
/>
</basic-container>
</mk-public-shell>
</template>
<script>
import MkPublicShell from '@/views/mk/mk-public-shell.vue';
import PreSettlementEditor from '@/views/settlement/components/pre-settlement-editor.vue';
export default {
name: 'PreSettlementPublicView',
components: { MkPublicShell, PreSettlementEditor },
computed: {
recordId() {
return this.$route.query.id || '';
},
},
methods: {
getForm() {
const form = this.$refs.page?.form || {};
return { ...form, subject: form.preSettlementNo || form.contractName || '' };
},
},
};
</script>
<style lang="scss" scoped>
.mk-public-form-title {
display: flex;
align-items: center;
min-height: 24px;
margin-bottom: 16px;
font-size: 18px;
font-weight: 600;
&::before {
width: 4px;
height: 20px;
margin-right: 8px;
background: #409eff;
content: '';
}
}
</style>
+1
View File
@@ -497,6 +497,7 @@ export default {
path: '/payment/payment-application/form',
query: {
mode: 'add',
paymentType: 'progress_advance',
transferToken,
preSettlementIds: sourcePreSettlements
.map(row => row.preSettlementId)
@@ -169,12 +169,6 @@
</template>
</el-table-column>
</el-table>
<div
v-if="!latestChangeLoading && !latestChangeRows.length"
class="settlement-detail-page__empty"
>
暂无变更记录
</div>
</el-tab-pane>
</el-tabs>
</div>
@@ -189,6 +183,7 @@
title="变更记录详情"
width="88%"
append-to-body
align-center
>
<el-table v-loading="changeRecordsDialog.loading" :data="changeRows" border>
<el-table-column type="index" label="序号" width="64" align="center" />
@@ -1159,28 +1154,16 @@ export default {
minWidth: 130,
align: 'right',
};
const dynamicColumns = this.isPayable
? [
{
label: '运输费',
prop: 'tableFreightAmount',
feeSummaryType: 'freight',
minWidth: 130,
align: 'right',
},
otherFeeColumn,
]
: [
...this.tableFeeItemNames.map((name, index) => ({
label: name,
prop: `tableFeeItem${index}`,
feeItemName: name,
dynamic: true,
minWidth: 130,
align: 'right',
})),
otherFeeColumn,
];
const dynamicColumns = [
{
label: '运输费',
prop: 'tableFreightAmount',
feeSummaryType: 'freight',
minWidth: 130,
align: 'right',
},
otherFeeColumn,
];
if (totalIndex < 0) return [...columns, ...dynamicColumns];
columns.splice(totalIndex, 0, ...dynamicColumns);
return columns;
@@ -1215,10 +1198,24 @@ export default {
await this.loadTable();
await this.openRouteDetail();
},
// 标签切走(keep-alive 缓存)或销毁时,收起 teleport/append-to-body 弹层,避免残留盖住其它页面
deactivated() {
this.closeInnerDialogs();
},
beforeUnmount() {
this.clearAdjustCalculations();
this.closeInnerDialogs();
},
methods: {
closeInnerDialogs() {
this.closeDetailPanel();
this.closeAdjustPanel();
this.changeRecordsDialog.visible = false;
this.updateFeeDialog.visible = false;
this.transferDialog.visible = false;
this.generateDialog.visible = false;
this.previewDialog.visible = false;
this.generateContractDialog.visible = false;
},
contractCategoryName(value) {
return (
this.contractCategoryOptions.find(item => String(item.value) === String(value))?.label ||
@@ -1504,7 +1501,7 @@ export default {
const res = await api.getList(this.page.current, this.page.size, params);
const data = this.unwrapPage(res);
this.rows = (data.records || []).map(this.decorateRow);
this.tableFeeItemNames = this.isPayable ? [] : this.collectFeeItemNames(this.rows);
this.tableFeeItemNames = [];
this.page.total = data.total || 0;
} finally {
this.loading = false;
@@ -1744,7 +1741,7 @@ export default {
});
const adjusted = {
...item,
transportQuantity: Number(item.transportQuantity || 0),
transportQuantity: this.normalizeAdjustTransportQuantity(item),
mileage:
item.mileage === null || item.mileage === undefined || Number(item.mileage) === -1
? null
@@ -1773,6 +1770,21 @@ export default {
feeSourceLabel(value) {
return ['手动录入', '手动添加', '手工录入'].includes(value) ? '手动录入' : '自动生成';
},
normalizeAdjustTransportQuantity(item = {}) {
const value = item.transportQuantity;
if (value === undefined || value === null || value === '' || Number(value) === -1) {
return '';
}
const element = item.billingFactor;
// 按车辆/固定金额生成时运输量会被写成占位 1,调整弹窗无实际运输量时不展示
if (
(element === '按车辆' || element === '固定金额(整单一口价)') &&
Number(value) === 1
) {
return '';
}
return Number(value);
},
adjustBillingTypes(row) {
return ADJUST_BILLING_TYPE_MAP[row.billingFactor] || [];
},
@@ -1900,7 +1912,12 @@ export default {
model: row.model,
billingFactor: row.billingFactor,
billingType: row.billingType,
transportQuantity: row.transportQuantity,
transportQuantity:
row.transportQuantity === '' ||
row.transportQuantity === null ||
row.transportQuantity === undefined
? null
: Number(row.transportQuantity),
priceUnit: row.priceUnit,
unitPrice: row.unitPrice,
mileage: row.mileage,
@@ -2734,12 +2751,6 @@ export default {
padding: 16px 0;
}
.settlement-detail-page__empty {
padding: 24px 0;
color: #909399;
text-align: center;
}
.settlement-detail-page__dialog-form {
padding: 16px 20px;
background: #fff;
+316 -9
View File
@@ -30,6 +30,14 @@
@click="handleDelete"
>删除
</el-button>
<el-button
type="primary"
plain
:loading="oaSyncLoading"
v-if="userInfo.authority.includes('admin')"
@click="handleOaOrgSync"
>自动同步组织
</el-button>
</template>
<template #menu="scope">
<el-link
@@ -116,11 +124,62 @@
/>
</div>
</el-dialog>
<el-dialog
v-model="oaSyncVisible"
width="480px"
append-to-body
:close-on-click-modal="false"
:close-on-press-escape="!oaSyncRunning"
:show-close="!oaSyncRunning"
class="oa-sync-dialog"
@close="closeOaSyncDialog"
>
<template #header>
<span class="dialog-title">{{ oaSyncDialogTitle }}</span>
</template>
<div class="oa-sync-body">
<el-progress
:percentage="oaSyncPercent"
:status="oaSyncProgressStatus"
:stroke-width="12"
/>
<div class="oa-sync-meta" v-if="oaSyncStage === 'clear'">当前阶段:{{ oaSyncStageLabel }}</div>
<div class="oa-sync-meta" v-else>
当前阶段:{{ oaSyncStageLabel }},第 {{ oaSyncProgress.current || 0 }} / {{ oaSyncTotalPage }} 页
</div>
<div class="oa-sync-stats">
<div class="oa-sync-stat">
<span class="oa-sync-stat__label">同步成功</span>
<span class="oa-sync-stat__value oa-sync-stat__value--success">{{ oaSyncProgress.synced }}</span>
</div>
<div class="oa-sync-stat">
<span class="oa-sync-stat__label">跳过</span>
<span class="oa-sync-stat__value oa-sync-stat__value--skip">{{ oaSyncProgress.skipped }}</span>
</div>
</div>
</div>
<template #footer>
<span class="dialog-footer">
<el-button v-if="oaSyncRunning" @click="cancelOaSync">取消</el-button>
<el-button v-else type="primary" @click="closeOaSyncDialog">关闭</el-button>
</span>
</template>
</el-dialog>
</basic-container>
</template>
<script>
import { getLazyList, remove, update, add, getDept, getDeptTree } from '@/api/system/dept';
import {
getLazyList,
remove,
update,
add,
getDept,
getDeptTree,
syncOaCompany,
syncOaDepartment,
clearNonTopDept,
} from '@/api/system/dept';
import { getLeaderList } from '@/api/system/user';
import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive';
import { mapGetters } from 'vuex';
@@ -152,6 +211,21 @@ export default {
selectionList: [],
query: {},
loading: true,
oaSyncLoading: false,
oaSyncVisible: false,
oaSyncRunning: false,
oaSyncCancelled: false,
oaSyncStatus: 'running',
oaSyncStage: 'company',
oaSyncClearNonTop: false,
oaSyncController: null,
oaSyncProgress: {
current: 0,
size: 20,
total: 0,
synced: 0,
skipped: 0,
},
parentId: 0,
page: {
pageSize: 10,
@@ -216,8 +290,9 @@ export default {
return;
}
const parentId = this.normalizeParentId(this.form?.parentId);
// 顶级组织不选择上级时,编码不依赖上级编码
if (!parentId) {
callback(new Error('请先选择上级组织'));
callback();
return;
}
if (!this.parentDept || String(this.parentDept.id) !== String(parentId)) {
@@ -358,13 +433,6 @@ export default {
props: {
label: 'title',
},
rules: [
{
required: true,
message: '请选择上级组织',
trigger: 'click',
},
],
},
{
label: '所属租户',
@@ -436,8 +504,177 @@ export default {
});
return ids.join(',');
},
oaSyncDialogTitle() {
if (this.oaSyncStatus === 'done') {
return '同步完成';
}
if (this.oaSyncStatus === 'cancelled') {
return '已取消同步';
}
if (this.oaSyncStatus === 'error') {
return '同步失败';
}
return '自动同步组织';
},
oaSyncStageLabel() {
if (this.oaSyncStage === 'clear') {
return '清除非顶级组织';
}
return this.oaSyncStage === 'department' ? '同步部门' : '同步公司';
},
oaSyncTotalPage() {
const total = Number(this.oaSyncProgress.total) || 0;
const size = Number(this.oaSyncProgress.size) || 20;
if (total <= 0) {
return this.oaSyncProgress.current || 0;
}
return Math.max(1, Math.ceil(total / size));
},
oaSyncPercent() {
if (this.oaSyncStatus === 'done') {
return 100;
}
const totalPage = this.oaSyncTotalPage;
const current = Number(this.oaSyncProgress.current) || 0;
const stageBase = this.oaSyncStage === 'department' ? 50 : 0;
if (totalPage <= 0) {
return stageBase;
}
const stagePercent = Math.min(50, Math.round((current / totalPage) * 50));
return Math.min(99, stageBase + stagePercent);
},
oaSyncProgressStatus() {
if (this.oaSyncStatus === 'done') {
return 'success';
}
if (this.oaSyncStatus === 'error') {
return 'exception';
}
return undefined;
},
},
methods: {
handleOaOrgSync() {
this.$confirm(
'是否清除非顶级组织?选择“是”将先删除顶级以外的组织后再同步;选择“否”则直接同步。',
'提示',
{
confirmButtonText: '是',
cancelButtonText: '否',
distinguishCancelAndClose: true,
closeOnClickModal: false,
type: 'warning',
}
)
.then(() => {
this.startOaOrgSync(true);
})
.catch(action => {
if (action === 'cancel') {
this.startOaOrgSync(false);
}
});
},
startOaOrgSync(clearNonTop) {
this.oaSyncLoading = true;
this.oaSyncVisible = true;
this.oaSyncRunning = true;
this.oaSyncCancelled = false;
this.oaSyncStatus = 'running';
this.oaSyncClearNonTop = !!clearNonTop;
this.oaSyncStage = clearNonTop ? 'clear' : 'company';
this.oaSyncController = new AbortController();
this.oaSyncProgress = {
current: 0,
size: 20,
total: 0,
synced: 0,
skipped: 0,
};
this.runOaOrgSyncPages();
},
isOaSyncCanceledError(error) {
return (
this.oaSyncCancelled ||
error?.code === 'ERR_CANCELED' ||
error?.name === 'CanceledError' ||
error?.name === 'AbortError'
);
},
async runOaOrgSyncStage(syncApi) {
const size = 20;
let current = 1;
while (!this.oaSyncCancelled) {
const res = await syncApi(current, size, this.oaSyncController?.signal);
const page = res?.data?.data || {};
this.oaSyncProgress.current = page.current || current;
this.oaSyncProgress.size = page.size || size;
this.oaSyncProgress.total = page.total || 0;
this.oaSyncProgress.synced += page.syncedCount || 0;
this.oaSyncProgress.skipped += page.skippedCount || 0;
if (page.finished) {
break;
}
current += 1;
}
},
async runOaOrgSyncPages() {
try {
if (this.oaSyncClearNonTop) {
this.oaSyncStage = 'clear';
await clearNonTopDept(this.oaSyncController?.signal);
if (this.oaSyncCancelled) {
this.oaSyncStatus = 'cancelled';
return;
}
}
this.oaSyncStage = 'company';
await this.runOaOrgSyncStage(syncOaCompany);
if (this.oaSyncCancelled) {
this.oaSyncStatus = 'cancelled';
return;
}
this.oaSyncStage = 'department';
this.oaSyncProgress.current = 0;
this.oaSyncProgress.total = 0;
await this.runOaOrgSyncStage(syncOaDepartment);
if (this.oaSyncCancelled) {
this.oaSyncStatus = 'cancelled';
return;
}
this.oaSyncStatus = 'done';
} catch (error) {
if (this.isOaSyncCanceledError(error)) {
this.oaSyncStatus = 'cancelled';
} else {
this.oaSyncStatus = 'error';
this.$message.error(error?.message || 'OA组织同步失败');
}
} finally {
this.oaSyncRunning = false;
this.oaSyncLoading = false;
if (this.oaSyncStatus === 'done' || this.oaSyncStatus === 'cancelled') {
this.parentId = 0;
this.data = [];
this.$refs.crud?.refreshTable?.();
this.onLoad(this.page, this.query);
}
}
},
cancelOaSync() {
if (!this.oaSyncRunning) {
return;
}
this.oaSyncCancelled = true;
this.oaSyncController?.abort();
},
closeOaSyncDialog() {
if (this.oaSyncRunning) {
this.cancelOaSync();
return;
}
this.oaSyncVisible = false;
},
initData(tenantId) {
getDeptTree(tenantId).then(res => {
const column = this.findColumn(this.option.column, 'parentId');
@@ -605,6 +842,11 @@ export default {
.filter(Boolean);
return result.length ? result.join('、') : '-';
},
normalizeTopParent(row) {
if (!this.normalizeParentId(row?.parentId)) {
row.parentId = 0;
}
},
isRootDept(row) {
return row && (row.parentId === 0 || String(row.parentId) === '0');
},
@@ -620,6 +862,7 @@ export default {
row.tenantId = row.tenantId || this.userInfo.tenantId || website.tenantId;
row.deptCode = String(row.deptCode || '').trim();
row.leaderId = func.join(row.leaderId);
this.normalizeTopParent(row);
if (Number(row.deptCategory) === 6 && !row.carrierCustomerId) {
this.$message.warning('请选择承运商');
loading();
@@ -649,6 +892,7 @@ export default {
row.tenantId = row.tenantId || this.userInfo.tenantId || website.tenantId;
row.deptCode = String(row.deptCode || '').trim();
row.leaderId = func.join(row.leaderId);
this.normalizeTopParent(row);
if (Number(row.deptCategory) === 6 && !row.carrierCustomerId) {
this.$message.warning('请选择承运商');
loading();
@@ -858,3 +1102,66 @@ export default {
color: var(--el-color-danger-light-3);
}
</style>
<style>
.oa-sync-dialog .dialog-title {
display: inline-flex;
align-items: center;
font-size: 16px;
font-weight: 600;
}
.oa-sync-dialog .dialog-title::before {
width: 4px;
height: 18px;
margin-right: 8px;
background: #409eff;
content: '';
}
.oa-sync-body {
padding: 8px 4px 0;
}
.oa-sync-meta {
margin-top: 12px;
color: #606266;
font-size: 13px;
}
.oa-sync-stats {
display: flex;
gap: 16px;
margin-top: 16px;
}
.oa-sync-stat {
flex: 1;
padding: 12px 16px;
background: #fafafa;
border: 1px solid #eff1f7;
border-radius: 4px;
}
.oa-sync-stat__label {
display: block;
color: #909399;
font-size: 12px;
}
.oa-sync-stat__value {
display: block;
margin-top: 6px;
font-size: 22px;
font-weight: 600;
line-height: 1.2;
}
.oa-sync-stat__value--success {
color: #409eff;
}
.oa-sync-stat__value--skip {
color: #909399;
}
</style>
+261 -11
View File
@@ -56,6 +56,14 @@
@click="handleAudit"
>审 核
</el-button>
<el-button
type="primary"
plain
:loading="iamSyncLoading"
v-if="userInfo.authority.includes('admin') && !auditMode"
@click="handleIamSync"
>同步人员
</el-button>
<el-button
type="success"
plain
@@ -190,6 +198,17 @@
<el-form ref="userFormRef" :model="form" :rules="userRules" label-position="right" label-width="calc(6em + 24px)">
<el-row :gutter="18">
<el-col :span="6"><el-form-item label="账号名" prop="account"><el-input v-model="form.account" /></el-form-item></el-col>
<el-col v-if="userDialogMode === 'add'" :span="6">
<el-form-item label="登录密码" prop="password">
<el-input
v-model="form.password"
type="password"
show-password
autocomplete="new-password"
placeholder="大于8位,含字母、数字、特殊字符.!@#$%^&*"
/>
</el-form-item>
</el-col>
<el-col :span="6"><el-form-item label="姓名" prop="realName"><el-input v-model="form.realName" /></el-form-item></el-col>
<el-col :span="6"><el-form-item label="手机号" prop="phone"><el-input v-model="form.phone" /></el-form-item></el-col>
<el-col :span="6"><el-form-item label="邮箱"><el-input v-model="form.email" /></el-form-item></el-col>
@@ -313,7 +332,12 @@
</el-col>
<el-col :span="24">
<el-form-item label="新密码" prop="password">
<el-input v-model="passwordForm.password" type="password" show-password />
<el-input
v-model="passwordForm.password"
type="password"
show-password
placeholder="大于8位,含字母、数字、特殊字符.!@#$%^&*"
/>
</el-form-item>
</el-col>
<el-col :span="24">
@@ -332,6 +356,45 @@
</template>
</el-dialog>
<el-dialog
v-model="oaSyncVisible"
width="480px"
append-to-body
:close-on-click-modal="false"
:close-on-press-escape="!oaSyncRunning"
:show-close="!oaSyncRunning"
class="oa-sync-dialog"
@close="closeOaSyncDialog"
>
<template #header>
<span class="dialog-title">{{ oaSyncDialogTitle }}</span>
</template>
<div class="oa-sync-body">
<el-progress
:percentage="oaSyncPercent"
:status="oaSyncProgressStatus"
:stroke-width="12"
/>
<div class="oa-sync-meta">当前进度:第 {{ oaSyncProgress.current || 0 }} / {{ oaSyncTotalPage }} 页</div>
<div class="oa-sync-stats">
<div class="oa-sync-stat">
<span class="oa-sync-stat__label">同步成功</span>
<span class="oa-sync-stat__value oa-sync-stat__value--success">{{ oaSyncProgress.synced }}</span>
</div>
<div class="oa-sync-stat">
<span class="oa-sync-stat__label">跳过</span>
<span class="oa-sync-stat__value oa-sync-stat__value--skip">{{ oaSyncProgress.skipped }}</span>
</div>
</div>
</div>
<template #footer>
<span class="dialog-footer">
<el-button v-if="oaSyncRunning" @click="cancelOaSync">取消</el-button>
<el-button v-else type="primary" @click="closeOaSyncDialog">关闭</el-button>
</span>
</template>
</el-dialog>
<!-- 认证日志组件 -->
<auth-log ref="authLog" />
<!-- 认证锁定配置组件 -->
@@ -348,6 +411,7 @@ import {
remove,
update,
add,
syncIamAccounts,
grant,
resetPassword,
setPassword,
@@ -365,6 +429,7 @@ import { mapGetters } from 'vuex';
import { h } from 'vue';
import { getToken } from '@/utils/auth';
import { downloadXls } from '@/utils/util';
import { validateLoginPassword } from '@/utils/validate';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import func from '@/utils/func';
@@ -393,6 +458,19 @@ export default {
selectionList: [],
query: {},
loading: true,
iamSyncLoading: false,
oaSyncVisible: false,
oaSyncRunning: false,
oaSyncCancelled: false,
oaSyncStatus: 'running',
oaSyncController: null,
oaSyncProgress: {
current: 0,
size: 50,
total: 0,
synced: 0,
skipped: 0,
},
page: {
pageSize: 10,
currentPage: 1,
@@ -415,8 +493,7 @@ export default {
passwordForm: {},
passwordRules: {
password: [
{ required: true, message: '请输入新密码', trigger: 'blur' },
{ min: 6, max: 32, message: '密码长度在6到32个字符', trigger: 'blur' },
{ required: true, validator: validateLoginPassword, trigger: 'blur' },
],
password2: [
{ required: true, message: '请再次输入新密码', trigger: 'blur' },
@@ -425,6 +502,7 @@ export default {
},
userRules: {
account: [{ required: true, message: '请输入账号名', trigger: 'blur' }],
password: [{ required: true, validator: validateLoginPassword, trigger: 'blur' }],
realName: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
deptId: [{ required: true, message: '请选择所属组织', trigger: 'change' }],
@@ -443,19 +521,56 @@ export default {
},
computed: {
...mapGetters(['userInfo', 'permission']),
// 所属组织级联配置:checkStrictly 为 false 时只能选择最后一级(叶子节点)
oaSyncDialogTitle() {
if (this.oaSyncStatus === 'done') {
return '同步完成';
}
if (this.oaSyncStatus === 'cancelled') {
return '已取消同步';
}
if (this.oaSyncStatus === 'error') {
return '同步失败';
}
return '同步人员';
},
oaSyncTotalPage() {
const total = Number(this.oaSyncProgress.total) || 0;
const size = Number(this.oaSyncProgress.size) || 50;
if (total <= 0) {
return this.oaSyncProgress.current || 0;
}
return Math.max(1, Math.ceil(total / size));
},
oaSyncPercent() {
if (this.oaSyncStatus === 'done') {
return 100;
}
const totalPage = this.oaSyncTotalPage;
const current = Number(this.oaSyncProgress.current) || 0;
if (totalPage <= 0) {
return 0;
}
return Math.min(100, Math.round((current / totalPage) * 100));
},
oaSyncProgressStatus() {
if (this.oaSyncStatus === 'done') {
return 'success';
}
if (this.oaSyncStatus === 'error') {
return 'exception';
}
return undefined;
},
// 所属组织级联配置:checkStrictly 为 true 时任意一级都可选择
deptCascaderProps() {
return {
label: 'title',
value: 'id',
children: 'children',
emitPath: false,
checkStrictly: false,
checkStrictly: true,
expandTrigger: 'click',
leaf: (data, node) => {
// 判断是否为叶子节点:没有 children 或 children 为空数组
return !data.children || data.children.length === 0;
},
leaf: data => !data.children || data.children.length === 0,
};
},
// 所属组织为单选级联:form.deptId 为数组(提交时 join),级联返回单个 id 值
@@ -553,6 +668,89 @@ export default {
this.handleExport();
}
},
handleIamSync() {
this.$confirm('确定从OA同步人员及组织信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
this.startOaSync();
});
},
startOaSync() {
this.iamSyncLoading = true;
this.oaSyncVisible = true;
this.oaSyncRunning = true;
this.oaSyncCancelled = false;
this.oaSyncStatus = 'running';
this.oaSyncController = new AbortController();
this.oaSyncProgress = {
current: 0,
size: 50,
total: 0,
synced: 0,
skipped: 0,
};
this.runOaSyncPages();
},
isOaSyncCanceledError(error) {
return (
this.oaSyncCancelled ||
error?.code === 'ERR_CANCELED' ||
error?.name === 'CanceledError' ||
error?.name === 'AbortError'
);
},
async runOaSyncPages() {
const size = 50;
let current = 1;
try {
while (!this.oaSyncCancelled) {
const res = await syncIamAccounts(current, size, this.oaSyncController?.signal);
const page = res?.data?.data || {};
this.oaSyncProgress.current = page.current || current;
this.oaSyncProgress.size = page.size || size;
this.oaSyncProgress.total = page.total || 0;
this.oaSyncProgress.synced += page.syncedCount || 0;
this.oaSyncProgress.skipped += page.skippedCount || 0;
if (page.finished) {
this.oaSyncStatus = 'done';
break;
}
current += 1;
}
if (this.oaSyncCancelled && this.oaSyncStatus === 'running') {
this.oaSyncStatus = 'cancelled';
}
} catch (error) {
if (this.isOaSyncCanceledError(error)) {
this.oaSyncStatus = 'cancelled';
} else {
this.oaSyncStatus = 'error';
this.$message.error(error?.message || 'OA人员同步失败');
}
} finally {
this.oaSyncRunning = false;
this.iamSyncLoading = false;
if (this.oaSyncStatus === 'done' || this.oaSyncStatus === 'cancelled') {
this.onLoad(this.page, this.query);
}
}
},
cancelOaSync() {
if (!this.oaSyncRunning) {
return;
}
this.oaSyncCancelled = true;
this.oaSyncController?.abort();
},
closeOaSyncDialog() {
if (this.oaSyncRunning) {
this.cancelOaSync();
return;
}
this.oaSyncVisible = false;
},
handleSetLeader(row) {
const tip = row.isLeader === 1 ? '确定取消用户的主管职务?' : '确定设置用户为主管职务?';
const message = row.isLeader === 1 ? '取消主管成功!' : '设置主管成功!';
@@ -651,6 +849,7 @@ export default {
if (mode === 'add') {
this.form = {
account: '',
password: '',
realName: '',
phone: '',
email: '',
@@ -706,6 +905,9 @@ export default {
roleId: func.join(this.form.roleId),
leaderId: func.join(this.form.leaderId),
};
if (this.userDialogMode !== 'add') {
delete row.password;
}
const request = this.userDialogMode === 'add' ? add(row) : update(this.sensitiveManager.getSubmitData(row));
request.then(() => {
this.userDialog = false;
@@ -1121,14 +1323,16 @@ export default {
margin-top: 8px;
}
.user-edit-dialog .dialog-title {
.user-edit-dialog .dialog-title,
.oa-sync-dialog .dialog-title {
display: inline-flex;
align-items: center;
font-size: 16px;
font-weight: 600;
}
.user-edit-dialog .dialog-title::before {
.user-edit-dialog .dialog-title::before,
.oa-sync-dialog .dialog-title::before {
width: 4px;
height: 18px;
margin-right: 8px;
@@ -1136,6 +1340,52 @@ export default {
content: '';
}
.oa-sync-body {
padding: 8px 4px 0;
}
.oa-sync-meta {
margin-top: 12px;
color: #606266;
font-size: 13px;
}
.oa-sync-stats {
display: flex;
gap: 16px;
margin-top: 16px;
}
.oa-sync-stat {
flex: 1;
padding: 12px 16px;
background: #fafafa;
border: 1px solid #eff1f7;
border-radius: 4px;
}
.oa-sync-stat__label {
display: block;
color: #909399;
font-size: 12px;
}
.oa-sync-stat__value {
display: block;
margin-top: 6px;
font-size: 22px;
font-weight: 600;
line-height: 1.2;
}
.oa-sync-stat__value--success {
color: #409eff;
}
.oa-sync-stat__value--skip {
color: #909399;
}
.user-edit-dialog .el-form-item {
margin-bottom: 14px;
}
+14 -1
View File
@@ -91,7 +91,7 @@
<el-input
v-model="passwordForm.newPassword"
type="password"
placeholder="请输入新密码"
placeholder="大于8位,含字母、数字、特殊字符.!@#$%^&*"
show-password
>
<template #prefix>
@@ -143,6 +143,7 @@
import { getUserInfo, updateInfo, updatePassword } from '@/api/system/user';
import md5 from 'js-md5';
import { sensitive } from '@/utils/sensitive';
import { isValidLoginPassword, LOGIN_PASSWORD_RULE_MESSAGE } from '@/utils/validate';
import {
Plus,
Bell,
@@ -259,6 +260,18 @@ export default {
},
// 提交密码修改
submitPassword() {
if (!this.passwordForm.newPassword || !this.passwordForm.newPassword1) {
this.$message.warning('请输入新密码和确认密码');
return;
}
if (this.passwordForm.newPassword !== this.passwordForm.newPassword1) {
this.$message.warning('两次输入的新密码不一致');
return;
}
if (!isValidLoginPassword(this.passwordForm.newPassword)) {
this.$message.warning(LOGIN_PASSWORD_RULE_MESSAGE);
return;
}
this.loading = true;
updatePassword(
md5(this.passwordForm.oldPassword),
+5 -2
View File
@@ -1892,10 +1892,13 @@ export default {
overflow: hidden;
}
// 大尺寸模式:缩成 1.586:1 比例,左对齐(不再 100% 占栏)
// 大尺寸模式:跟随列宽自适应(最大 240px,约 1.586:1 证件比例),
// 保证不同分辨率 / 系统缩放下都与上方输入框左右对齐
:deep(.driver-uploader--large) {
display: block;
width: 240px;
width: 100%;
max-width: 240px;
flex: none;
margin: 0;
}
+5 -1
View File
@@ -1349,9 +1349,13 @@ export default {
height: 151px;
}
// 大尺寸模式:跟随列宽自适应(最大 248px),
// 保证不同分辨率 / 系统缩放下都与上方输入框左右对齐
:deep(.ship-uploader--large) {
display: block;
width: 248px;
width: 100%;
max-width: 248px;
flex: none;
margin: 0;
}
+61 -21
View File
@@ -129,7 +129,7 @@
>
<el-form
label-position="right"
label-width="calc(7em + 24px)"
label-width="calc(4em + 12px)"
class="certification-audit archive-form"
>
<section-card title="基础信息">
@@ -145,19 +145,25 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="外廓尺寸(毫米)">
<el-form-item label="外廓尺寸">
<div class="dimension-group">
<div class="dimension-group__item">
<span class="dimension-group__label">长</span>
<span class="certification-audit__value">{{ auditValue('outerLength') }}</span>
<span class="certification-audit__value">
{{ auditValueWithUnit('outerLength', 'mm') }}
</span>
</div>
<div class="dimension-group__item">
<span class="dimension-group__label">宽</span>
<span class="certification-audit__value">{{ auditValue('outerWidth') }}</span>
<span class="certification-audit__value">
{{ auditValueWithUnit('outerWidth', 'mm') }}
</span>
</div>
<div class="dimension-group__item">
<span class="dimension-group__label">高</span>
<span class="certification-audit__value">{{ auditValue('outerHeight') }}</span>
<span class="certification-audit__value">
{{ auditValueWithUnit('outerHeight', 'mm') }}
</span>
</div>
</div>
</el-form-item>
@@ -165,13 +171,17 @@
</el-row>
<el-row :gutter="18">
<el-col :span="6">
<el-form-item label="核定载质量(KG)">
<span class="certification-audit__value">{{ auditValue('approvedLoadKg') }}</span>
<el-form-item label="核定载质量">
<span class="certification-audit__value">
{{ auditValueWithUnit('approvedLoadKg', 'KG') }}
</span>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="准牵引总质量(KG)">
<span class="certification-audit__value">{{ auditValue('tractionMassKg') }}</span>
<el-form-item label="准牵引总质量">
<span class="certification-audit__value">
{{ auditValueWithUnit('tractionMassKg', 'KG') }}
</span>
</el-form-item>
</el-col>
<el-col :span="6">
@@ -357,7 +367,7 @@
v-if="showRejectReason"
class="certification-audit__reason"
label-position="right"
label-width="calc(7em + 24px)"
label-width="calc(4em + 24px)"
>
<el-form-item label="驳回原因" required>
<el-input
@@ -427,7 +437,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="外廓尺寸(毫米)">
<el-form-item label="外廓尺寸">
<div class="dimension-group">
<div class="dimension-group__item">
<span class="dimension-group__label">长</span>
@@ -436,7 +446,9 @@
inputmode="numeric"
placeholder="请输入"
@input="vehicleForm.outerLength = digitsOnly($event)"
/>
>
<template #suffix>mm</template>
</el-input>
</div>
<div class="dimension-group__item">
<span class="dimension-group__label">宽</span>
@@ -445,7 +457,9 @@
inputmode="numeric"
placeholder="请输入"
@input="vehicleForm.outerWidth = digitsOnly($event)"
/>
>
<template #suffix>mm</template>
</el-input>
</div>
<div class="dimension-group__item">
<span class="dimension-group__label">高</span>
@@ -454,7 +468,9 @@
inputmode="numeric"
placeholder="请输入"
@input="vehicleForm.outerHeight = digitsOnly($event)"
/>
>
<template #suffix>mm</template>
</el-input>
</div>
</div>
</el-form-item>
@@ -462,23 +478,27 @@
</el-row>
<el-row :gutter="18">
<el-col :span="6">
<el-form-item label="核定载质量(KG)" prop="approvedLoadKg">
<el-form-item label="核定载质量" prop="approvedLoadKg">
<el-input
v-model="vehicleForm.approvedLoadKg"
inputmode="numeric"
placeholder="请输入"
@input="vehicleForm.approvedLoadKg = digitsOnly($event)"
/>
>
<template #suffix>KG</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="准牵引总质量(KG)" prop="tractionMassKg">
<el-form-item label="准牵引总质量" prop="tractionMassKg">
<el-input
v-model="vehicleForm.tractionMassKg"
inputmode="numeric"
placeholder="请输入"
@input="vehicleForm.tractionMassKg = digitsOnly($event)"
/>
>
<template #suffix>KG</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
@@ -896,6 +916,7 @@ export default {
energyTypeOptions: ['柴油', '汽油', '新能源', '天然气'],
baseRules: {
organizationName: [{ required: true, message: '请选择所属组织', trigger: 'change' }],
useDepartment: [{ required: true, message: '请选择使用部门', trigger: 'change' }],
plateNo: [
{ required: true, message: '请输入车牌号', trigger: 'change' },
{ validator: this.validatePlateNo, trigger: 'change' },
@@ -986,6 +1007,9 @@ export default {
if (this.vehicleBox && !this.vehicleForm.id && !this.vehicleForm.organizationName) {
this.vehicleForm.organizationName = this.getCurrentOrganizationName();
}
if (this.vehicleBox && !this.vehicleForm.useDepartment) {
this.vehicleForm.useDepartment = this.getCurrentOrganizationName();
}
});
},
flattenDeptOptions(tree = [], level = 0) {
@@ -1061,6 +1085,7 @@ export default {
if (!row?.id) {
this.vehicleForm = emptyForm();
this.vehicleForm.organizationName = this.getCurrentOrganizationName();
this.vehicleForm.useDepartment = this.getCurrentOrganizationName();
this.syncPlateNo(false);
this.vehicleBox = true;
return;
@@ -1070,6 +1095,9 @@ export default {
...emptyForm(),
...(res.data.data || {}),
};
if (!this.vehicleForm.useDepartment) {
this.vehicleForm.useDepartment = this.getCurrentOrganizationName();
}
this.splitPlateNo();
this.syncPlateNo(false);
this.vehicleBox = true;
@@ -1102,6 +1130,10 @@ export default {
const value = this.certificationAuditForm[prop];
return value === undefined || value === null || value === '' ? '-' : value;
},
auditValueWithUnit(prop, unit) {
const value = this.auditValue(prop);
return value === '-' ? value : `${value}${unit}`;
},
handleCertificationApprove() {
auditCertification(this.certificationAuditForm.id, 1).then(() => {
this.$message.success('认证已通过');
@@ -1693,11 +1725,19 @@ export default {
}
}
.certification-audit,
.certification-audit {
:deep(.el-form-item__label) {
flex: 0 0 calc(4em + 12px) !important;
width: calc(4em + 12px) !important;
max-width: calc(4em + 12px);
}
}
.certification-audit__reason {
:deep(.el-form-item__label) {
flex: 0 0 calc(7em + 24px) !important;
width: calc(7em + 24px) !important;
flex: 0 0 calc(4em + 24px) !important;
width: calc(4em + 24px) !important;
max-width: calc(4em + 24px);
}
}
@@ -0,0 +1,168 @@
<template>
<div ref="page" class="customer-archive-public-view">
<customer-archive ref="archive" />
</div>
</template>
<script>
import CustomerArchive from './customer-archive.vue';
import { postPublicProcessMessage } from '@/api/vehicle/customer-archive';
export default {
name: 'CustomerArchivePublicView',
components: {
CustomerArchive,
},
created() {
this.handleIframeHeight = () => this.sendIframeHeight();
this.handleProcessMessage = event => this.onProcessMessage(event);
document.addEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.addEventListener('message', this.handleProcessMessage);
},
mounted() {
document.documentElement.classList.add('mk-iframe-page');
document.body.classList.add('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.add('mk-iframe-page');
this.handleIframeHeight();
window.addEventListener('load', this.handleIframeHeight);
this.mkHeightTimers = [300, 800, 1600].map(delay =>
setTimeout(this.handleIframeHeight, delay)
);
if (typeof ResizeObserver === 'undefined') return;
this.mkHeightObserver = new ResizeObserver(() => this.handleIframeHeight());
this.$nextTick(() => {
if (this.$refs.page) this.mkHeightObserver.observe(this.$refs.page);
this.mkHeightObserver.observe(document.body);
});
},
beforeUnmount() {
document.removeEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.removeEventListener('load', this.handleIframeHeight);
window.removeEventListener('message', this.handleProcessMessage);
(this.mkHeightTimers || []).forEach(timer => clearTimeout(timer));
if (this.mkHeightObserver) {
this.mkHeightObserver.disconnect();
this.mkHeightObserver = null;
}
document.documentElement.classList.remove('mk-iframe-page');
document.body.classList.remove('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.remove('mk-iframe-page');
},
methods: {
sendIframeHeight() {
this.$nextTick(() => {
var tbody = document.body;
var height = tbody.clientHeight;
// 如需动态改变表单高度,可以直接发送此postMessage
window.parent.postMessage({ height: height }, '*');
});
},
onProcessMessage(event) {
const data = event && event.data;
if (!data || typeof data !== 'object') return;
if (data.height && !data.status && !data.type) return;
if (data.type === 'formValues' || data.type === 'afterSubmit') return;
console.log('客商公开页收到流程消息:', data);
const formValues = data.formValues;
if (data.status === 'submit') {
this.submitData(formValues);
} else if (data.status === 'save') {
this.saveData(formValues);
}
if (data.type === 'getFormValues') {
window.parent.postMessage({ type: 'formValues', formData: this.buildFormData() }, '*');
}
},
submitData(lbpmFormValues) {
const formData = this.buildFormData();
this.postFormData('submit', lbpmFormValues, formData);
if (!lbpmFormValues) return;
const parameters = Object.assign({}, lbpmFormValues, {
loginName: this.getLoginName(lbpmFormValues),
formInstanceId: this.getFormId(),
subject: formData.subject,
});
window.parent.postMessage(
{
type: 'afterSubmit',
success: true,
parameters,
},
'*'
);
},
saveData(lbpmFormValues) {
this.postFormData('save', lbpmFormValues, this.buildFormData());
},
postFormData(status, formValues, formData) {
const payload = {
status,
formValues: formValues || {},
formData,
};
console.log('客商公开页提交流程数据:', payload);
postPublicProcessMessage(payload).catch(error => {
console.error('客商公开页提交流程数据失败:', error);
});
},
buildFormData() {
const archive = this.getArchiveForm();
return {
...archive,
subject: archive.fullName || archive.shortName || '',
formInstanceId: this.getFormId(),
};
},
getArchiveForm() {
const archive = this.$refs.archive && this.$refs.archive.archiveForm;
if (!archive) return {};
try {
return JSON.parse(JSON.stringify(archive));
} catch (error) {
return { ...archive };
}
},
getFormId() {
return this.$route.query.id || this.getArchiveForm().id || '';
},
getLoginName(formValues = {}) {
return (
formValues.loginName ||
this.$route.query.loginName ||
this.$route.query.submitIdentity ||
''
);
},
},
};
</script>
<style lang="scss">
html.mk-iframe-page,
html.mk-iframe-page body,
html.mk-iframe-page #app,
html.mk-iframe-page #app.mk-iframe-page {
height: auto !important;
min-height: 100%;
overflow: visible;
}
</style>
<style lang="scss" scoped>
.customer-archive-public-view {
min-height: 100%;
padding: 12px 0 24px;
box-sizing: border-box;
background: #f0f2f5;
:deep(.basic-container) {
padding: 0 12px;
}
:deep(.archive-page-form .archive-form__footer) {
left: 0;
}
}
</style>
+374 -135
View File
@@ -1,5 +1,5 @@
<template>
<basic-container class="customer-archive-page">
<basic-container class="customer-archive-page" :class="{ 'is-public-view': isPublicViewPage }">
<avue-crud
v-if="!isArchivePage"
:option="option"
@@ -150,9 +150,24 @@
>
撤回
</el-link>
<el-link
type="primary"
v-if="
hasPermission('customer_type_re_cert') &&
row.approvalStatus === 'reviewing' &&
row.reviewStatus !== '已完成'
"
@click="openReview(row)"
>
复评
</el-link>
<el-link
type="success"
v-if="hasPermission('customer_archive_approve') && row.approvalStatus === 'reviewing'"
v-if="
hasPermission('customer_archive_approve') &&
row.approvalStatus === 'reviewing' &&
row.reviewStatus === '已完成'
"
@click="handleApprove(row)"
>
审核通过
@@ -547,7 +562,7 @@
<span>{{ formatScoreValue(row.selfScore) }}</span>
</template>
</el-table-column>
<el-table-column label="复评得分" min-width="145" align="center">
<el-table-column v-if="archiveForm.id" label="复评得分" min-width="145" align="center">
<template #default="{ row }">
<span>{{ formatScoreValue(row.reviewScore) }}</span>
</template>
@@ -583,11 +598,18 @@
<span>{{ row.reviewStatus }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="135" fixed="right" align="center">
<el-table-column label="操作" width="160" fixed="right" align="center">
<template #default="{ row }">
<el-link type="primary" @click="openScore(row.__raw, row.__rawIndex)">
详情
</el-link>
<el-link
v-if="showScoreDelete"
type="danger"
@click="deleteScore(row.__rawIndex)"
>
删除
</el-link>
</template>
</el-table-column>
</el-table>
@@ -654,6 +676,7 @@
<el-table-column label="开户人姓名" prop="accountHolderName" min-width="150" />
<el-table-column label="收款账号" prop="bankAccount" min-width="180" />
<el-table-column label="开户行" prop="bankName" min-width="180" />
<el-table-column label="联行号" prop="cnapsCode" min-width="160" />
<el-table-column label="备注" prop="remark" min-width="180" />
<el-table-column
label="操作"
@@ -905,45 +928,12 @@
/>
</section-card>
<el-dialog
<change-record-detail-dialog
v-model="changeRecordDetailVisible"
title="变更记录详情"
append-to-body
destroy-on-close
width="1100px"
top="10px"
class="change-record-detail-dialog"
>
<div v-if="changeRecordDetail" class="change-record-detail-meta">
<span>变更日期:{{ changeRecordDetail.changeTime || '-' }}</span>
<span>变更账号:{{ changeRecordDetail.changeUserName || '-' }}</span>
</div>
<el-table :data="changeRecordDetailRows" border :show-overflow-tooltip="false">
<el-table-column prop="field" label="变更字段" min-width="180" />
<el-table-column
prop="before"
label="变更前"
min-width="360"
class-name="change-record-detail-value"
/>
<el-table-column
prop="after"
label="变更后"
min-width="500"
class-name="change-record-detail-value"
/>
</el-table>
<el-empty
v-if="!changeRecordDetailRows.length"
description="暂无变更内容"
:image-size="60"
/>
<template #footer>
<el-button type="primary" @click="changeRecordDetailVisible = false">关闭</el-button>
</template>
</el-dialog>
:rows="changeRecordDetailRows"
/>
<div class="archive-form__footer">
<div class="archive-form__footer" v-if="!isPublicViewPage">
<!-- 次要:独立页返回 / 只读关闭 / 弹窗取消 -->
<el-button @click="closeArchive">{{ readonly ? '关闭' : '取消' }}</el-button>
<el-button type="primary" plain v-if="!readonly" @click="saveArchive">保存</el-button>
@@ -1052,6 +1042,9 @@
<el-form-item label="开户行" prop="bankName">
<el-input v-model="receiptForm.bankName" maxlength="100" />
</el-form-item>
<el-form-item label="联行号" prop="cnapsCode">
<el-input v-model="receiptForm.cnapsCode" maxlength="32" />
</el-form-item>
<el-form-item label="收款账号" prop="bankAccount">
<el-input v-model="receiptForm.bankAccount" maxlength="50" />
</el-form-item>
@@ -1169,17 +1162,18 @@
<el-input v-model="row.email" maxlength="100" :disabled="readonly" />
</template>
</el-table-column>
<el-table-column label="所属部门" min-width="200">
<el-table-column label="所属部门" min-width="220">
<template #default="{ row }">
<el-input
v-if="!isInternalCustomer"
:model-value="row.deptNames"
disabled
/>
<el-select
<el-cascader
v-else
v-model="row.deptIdList"
multiple
:options="deptTree"
:props="invoiceDeptCascaderProps"
collapse-tags
collapse-tags-tooltip
filterable
@@ -1187,14 +1181,7 @@
:disabled="readonly"
placeholder="请选择所属部门"
@change="() => handleInvoiceContactDeptChange(row)"
>
<el-option
v-for="item in invoiceDeptOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
/>
</template>
</el-table-column>
<el-table-column label="备注" min-width="160">
@@ -1349,7 +1336,25 @@
class="score-detail-table score-detail-table--inline"
max-height="520"
>
<el-table-column label="评分项目" prop="itemName" width="150" align="center" />
<el-table-column
label="评分项目"
width="150"
align="center"
:show-overflow-tooltip="false"
>
<template #default="{ row: detail }">
<el-tooltip
:content="detail.itemName"
placement="top"
effect="dark"
append-to="body"
:show-after="200"
:disabled="!detail.itemName"
>
<span class="score-item-name">{{ detail.itemName }}</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="评分标准" min-width="430">
<template #default="{ row: detail }">
<div class="score-standard-cell">
@@ -1359,6 +1364,7 @@
inputmode="decimal"
:disabled="readonly"
@input="value => handleScoreValueInput(detail, value)"
@blur="handleScoreValueBlur(detail)"
>
<template #append>{{ getScoreRule(detail)?.changeUnit || '' }}</template>
</el-input>
@@ -1388,13 +1394,15 @@
<span>{{ formatScoreValue(getSignedScore(detail, 'selfScore')) }}分</span>
</template>
</el-table-column>
<el-table-column label="复评得分" width="150" align="center">
<el-table-column v-if="!isNewScore" label="复评得分" width="150" align="center">
<template #default="{ row: detail }">
<el-input
v-model="detail.reviewScore"
maxlength="10"
inputmode="decimal"
:disabled="readonly || !hasPermission('customer_type_re_cert')"
:disabled="
(!reviewMode && readonly) || !hasPermission('customer_type_re_cert')
"
@input="value => handleScoreDetailScoreInput(detail, 'reviewScore', value)"
>
<template
@@ -1415,7 +1423,7 @@
<template #default="{ row }">
<span class="score-category-table__name">{{ row.categoryName }}</span>
<span>自评:{{ getSignedScore(row, 'selfScore') }}分</span>
<span>复评:{{ getSignedScore(row, 'reviewScore') }}分</span>
<span v-if="!isNewScore">复评:{{ getSignedScore(row, 'reviewScore') }}分</span>
</template>
</el-table-column>
<el-table-column width="60" align="center">
@@ -1489,12 +1497,15 @@
<div class="score-detail-dialog__total">
<span>总分合计</span>
<span>自评:{{ formatScoreValue(currentScore.selfScore) }}分</span>
<span>复评:{{ formatScoreValue(currentScore.reviewScore) }}分</span>
<span v-if="!isNewScore">复评:{{ formatScoreValue(currentScore.reviewScore) }}分</span>
</div>
<el-button @click="scoreBox = false">取消</el-button>
<el-button type="primary" plain v-if="!readonly" @click="saveScoreDetail">保存</el-button>
<el-button v-if="isNewScore" type="primary" @click="submitSelfScore">提交自评</el-button>
<el-button type="primary" plain v-if="!readonly && !isNewScore" @click="saveScoreDetail">
保存
</el-button>
<el-button
v-if="!readonly && hasPermission('customer_type_re_cert')"
v-if="!isNewScore && (!readonly || reviewMode) && hasPermission('customer_type_re_cert')"
type="primary"
@click="confirmReviewScore"
>
@@ -1512,7 +1523,9 @@ import { ElCascader } from 'element-plus';
import {
getList,
getDetail,
getPublicDetail,
getChangeRecordList,
getPublicChangeRecordList,
submit,
submitApproval,
withdrawApproval,
@@ -1530,6 +1543,7 @@ import {
getDetail as getCreditScoreQuantificationDetail,
} from '@/api/vehicle/credit-score-quantification';
import { getDictionary } from '@/api/system/dictbiz';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
import { getDeptTree } from '@/api/system/dept';
import { getLazyTree } from '@/api/base/region';
import { exportBlob } from '@/api/common';
@@ -1548,6 +1562,7 @@ import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import SectionCard from '@/components/section-card/main.vue';
import PdfPreview from '@/components/pdf-preview/main.vue';
import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue';
const createTimeRangeMap = {
createTimeRange: ['createTimeStart', 'createTimeEnd'],
@@ -1563,11 +1578,18 @@ const qualificationViewerPlugins = [
export default {
components: {
SectionCard,
ChangeRecordDetailDialog,
ArrowRight,
ElImageViewer,
OpenFileViewer,
PdfPreview,
},
props: {
embeddedPublicId: {
type: [String, Number],
default: '',
},
},
data() {
const nonNegativeLabelMap = {
invoiceTaxRate: '开票税点',
@@ -1640,6 +1662,8 @@ export default {
receiptBox: false,
invoiceBox: false,
readonly: false,
reviewMode: false,
listActivated: false,
originalAccessType: '',
activeTab: 'scores',
archiveForm: this.emptyArchive(),
@@ -1800,6 +1824,7 @@ export default {
accountName: [{ required: true, message: '请输入收款单位名称', trigger: 'blur' }],
accountHolderName: [{ required: true, message: '请输入开户人姓名', trigger: 'blur' }],
bankName: [{ required: true, message: '请输入开户行', trigger: 'blur' }],
cnapsCode: [{ required: true, message: '请输入联行号', trigger: 'blur' }],
bankAccount: [{ required: true, message: '请输入收款账号', trigger: 'blur' }],
remark: [{ max: 200, message: '备注最多200个字符', trigger: 'blur' }],
},
@@ -1835,7 +1860,7 @@ export default {
editBtn: false,
selection: true,
dialogClickModal: false,
menuWidth: 280,
menuWidth: 320,
column: [
{
label: '客商编号',
@@ -2019,15 +2044,36 @@ export default {
};
},
created() {
if (this.isPublicViewPage) {
this.readonly = true;
const id = this.embeddedPublicId || this.$route.query.id;
if (!id) {
this.archiveBox = true;
this.$message.error('缺少客商ID');
return;
}
this.openArchive({ id }, true);
return;
}
this.initDeptTree();
this.initRegionOptions();
this.initBusinessDictionaries();
this.initScoreQuantificationOptions();
if (this.isArchivePage) {
const readonly = this.$route.query.view === '1' || this.$route.query.view === 'true';
this.reviewMode = this.$route.query.review === '1';
const readonly =
this.$route.query.view === '1' || this.$route.query.view === 'true' || this.reviewMode;
this.openArchive(this.$route.query.id ? { id: this.$route.query.id } : null, readonly);
}
},
activated() {
if (this.isArchivePage || this.isPublicViewPage) return;
if (!this.listActivated) {
this.listActivated = true;
return;
}
this.onLoad(this.page, this.query);
},
computed: {
...mapGetters(['permission', 'userInfo']),
isAdmin() {
@@ -2043,7 +2089,14 @@ export default {
};
},
isArchivePage() {
return this.$route.path === '/vehicle/customer-archive/form';
return (
this.$route.path === '/vehicle/customer-archive/form' || this.isPublicViewPage
);
},
isPublicViewPage() {
return (
this.$route.path === '/vehicle/customer-archive/public-view' || !!this.embeddedPublicId
);
},
archiveContainer() {
return 'div';
@@ -2069,6 +2122,18 @@ export default {
expandTrigger: 'click',
};
},
// 发票联系信息所属部门:级联多选,可勾选任意层级
invoiceDeptCascaderProps() {
return {
value: 'value',
label: 'label',
children: 'children',
multiple: true,
checkStrictly: true,
emitPath: false,
expandTrigger: 'click',
};
},
// 所属组织级联值:archiveForm.deptId 只存选中的部门 ID(单选),
// 级联控件需要根到选中节点的完整路径,两者在此做双向转换——
// 部门树是异步加载的,依赖 deptTree 可保证树加载完成后回显自动刷新。
@@ -2109,6 +2174,7 @@ export default {
return ids.join(',');
},
dialogTitle() {
if (this.reviewMode) return '客商复评';
if (this.readonly) return '查看客商档案';
return this.archiveForm.id ? '编辑客商档案' : '新增客商档案';
},
@@ -2129,12 +2195,6 @@ export default {
isInternalCustomer() {
return this.archiveForm.customerKind === 'internal';
},
invoiceDeptOptions() {
return this.flattenDept(this.deptTree).map(item => ({
label: item.rawLabel,
value: String(item.value),
}));
},
isTemporaryToFormal() {
return (
Boolean(this.archiveForm.id) &&
@@ -2152,6 +2212,14 @@ export default {
scoreList() {
return this.archiveForm.scores || [];
},
showScoreDelete() {
if (this.readonly) return false;
const status = this.archiveForm.approvalStatus || 'draft';
return status === 'draft' || status === 'rejected';
},
isNewScore() {
return this.scoreRecordIndex < 0 && !this.reviewMode;
},
scorePageCount() {
return Math.max(Math.ceil(this.scoreList.length / this.scorePage.pageSize), 1);
},
@@ -2226,6 +2294,45 @@ export default {
hasPermission(code) {
return this.isAdmin || this.validData(this.permission[code], false);
},
mergeSelectOptions(target, values) {
const list = Array.isArray(values) ? values : values ? [values] : [];
list.forEach(value => {
if (value === undefined || value === null || value === '') return;
if (!this[target].some(item => String(item.value) === String(value))) {
this[target].push({ label: String(value), value });
}
});
},
ensurePublicViewOptions(archive = {}) {
this.mergeSelectOptions('customerNatureOptions', archive.customerNature);
this.mergeSelectOptions('customerTypeOptions', archive.customerType);
this.mergeSelectOptions('businessScopeOptions', archive.businessScope);
this.mergeSelectOptions(
'qualificationTypeOptions',
(this.qualificationFiles || []).map(item => item.type)
);
const deptId = Array.isArray(archive.deptId) ? archive.deptId[0] : archive.deptId;
if (deptId && archive.deptName) {
this.deptTree = [
{
label: archive.deptName,
value: String(deptId),
children: [],
},
];
this.deptOptions = this.flattenDept(this.deptTree);
}
(archive.scores || []).forEach(score => {
if (!score.quantificationId) return;
const id = String(score.quantificationId);
if (!this.scoreQuantificationOptions.some(item => String(item.id) === id)) {
this.scoreQuantificationOptions.push({
id,
name: score.quantificationName || score.name || id,
});
}
});
},
unifiedCreditCodeError(value) {
const code = String(value || '')
.trim()
@@ -2430,7 +2537,8 @@ export default {
loadChangeRecords() {
if (!this.archiveForm.id) return;
const page = this.changeRecordPage;
getChangeRecordList(this.archiveForm.id, page.currentPage, page.pageSize).then(res => {
const requestList = this.isPublicViewPage ? getPublicChangeRecordList : getChangeRecordList;
requestList(this.archiveForm.id, page.currentPage, page.pageSize).then(res => {
const data = res.data.data || {};
page.records = this.replaceNegativeOneWithBlank(data.records || []);
page.total = Number(data.total || 0);
@@ -2788,6 +2896,7 @@ export default {
accountName: '',
accountHolderName: '',
bankName: '',
cnapsCode: '',
bankAccount: '',
registeredPhone: '',
registeredAddress: '',
@@ -3475,7 +3584,17 @@ export default {
this.invoiceForm.contacts.splice(index, 1);
},
handleInvoiceContactDeptChange(row) {
const ids = Array.isArray(row.deptIdList) ? row.deptIdList.map(item => String(item)) : [];
// emitPath=false 时,多选级联值为选中节点 id 数组
const rawList = Array.isArray(row.deptIdList) ? row.deptIdList : [];
const ids = rawList
.map(item => {
if (Array.isArray(item)) {
return item.length ? String(item[item.length - 1]) : '';
}
return item !== undefined && item !== null && item !== '' ? String(item) : '';
})
.filter(Boolean);
row.deptIdList = ids;
row.deptIds = ids.join(',');
row.deptNames = ids.map(id => this.findDeptLabel(id)).filter(Boolean).join('、');
},
@@ -4041,7 +4160,16 @@ export default {
query: { id: row.id, name: '查看客商档案', view: '1' },
});
},
openReview(row) {
this.$router.push({
path: '/vehicle/customer-archive/form',
query: { id: row.id, name: '客商复评', review: '1' },
});
},
closeArchive() {
if (this.isPublicViewPage) return;
this.archiveBox = false;
this.$router.$avueRouter?.closeTag?.();
this.$router.push('/vehicle/customer-archive');
},
openArchive(row, readonly = false) {
@@ -4050,7 +4178,9 @@ export default {
this.resetDetailPagination();
this.resetChangeRecordPage();
if (row && row.id) {
getDetail(row.id).then(res => {
const requestDetail = this.isPublicViewPage ? getPublicDetail : getDetail;
requestDetail(row.id)
.then(res => {
const archive = this.normalizeDetail(res.data.data);
this.archiveForm = readonly ? this.replaceNegativeOneWithBlank(archive) : archive;
this.originalAccessType = this.archiveForm.accessType || '';
@@ -4064,9 +4194,15 @@ export default {
this.qualificationUploadFiles = [];
this.ocrQualificationUploadFiles = [];
this.selectedQualificationFiles = [];
if (this.isPublicViewPage) this.ensurePublicViewOptions(this.archiveForm);
this.archiveBox = true;
this.loadChangeRecords();
});
if (this.reviewMode) this.openReviewScore();
})
.catch(() => {
this.archiveBox = true;
if (this.isPublicViewPage) this.$message.error('客商信息加载失败');
});
return;
}
this.archiveForm = this.emptyArchive();
@@ -4105,14 +4241,15 @@ export default {
this.invoiceForm = this.emptyInvoice();
this.$refs.archiveForm?.clearValidate();
},
// 客商材料不做提交校验,仅在页面上提示未上传项
validateFormalForApproval(archive) {
if (archive.accessType !== 'formal') return true;
const hasCompletedScore = (archive.scores || []).some(
item => item.selfStatus === '已完成' || item.reviewStatus === '已完成' || item.finalScore
);
if (!hasCompletedScore) {
this.$message.warning('正式客商提交审核前必须完成信用评分');
// 客商材料不做提交校验,仅在页面上提示未上传项。提交审批前必须完成自评,且评分记录只能有一条。
validateScoreForApproval(archive) {
const scores = archive.scores || [];
if (scores.length > 1) {
this.$message.warning('评分记录只能有一条');
return false;
}
if (scores.length !== 1 || scores[0].selfStatus !== '已完成') {
this.$message.warning('提交审批前必须完成自评');
return false;
}
return true;
@@ -4164,7 +4301,7 @@ export default {
.filter(item => item.contactName || item.contactPhone);
archive.receiptAccounts = (archive.receiptAccounts || [])
.map(item => this.normalizeReceipt(item))
.filter(item => item.accountName || item.accountHolderName || item.bankAccount);
.filter(item => item.accountName || item.accountHolderName || item.bankAccount || item.cnapsCode);
archive.invoices = (archive.invoices || [])
.map(item => {
const invoice = this.normalizeInvoice(item);
@@ -4230,7 +4367,7 @@ export default {
const archive = this.normalizeArchive();
// 仅提交时落变更记录;保存不记录
archive.recordChange = true;
if (!this.validateFormalForApproval(archive)) return;
if (!this.validateScoreForApproval(archive)) return;
submit(archive).then(res => {
const data = res.data.data;
const id = (data && typeof data === 'object' ? data.id : data) || this.archiveForm.id;
@@ -4240,7 +4377,16 @@ export default {
this.$message({ type: 'success', message: '保存成功,请在列表提交审批' });
return;
}
submitApproval(id).then(() => {
const fullName =
(data && typeof data === 'object' ? data.fullName : '') ||
archive.fullName ||
this.archiveForm.fullName ||
'';
this.submitCustomerApproval(
id,
fullName,
archive.approvalStatus || this.archiveForm.approvalStatus
).then(() => {
this.closeArchive();
this.onLoad(this.page);
this.$message({ type: 'success', message: '提交成功!' });
@@ -4248,9 +4394,32 @@ export default {
});
});
},
/**
* 列表 / 新增 / 编辑提交共用:开启 MK 时提交审核流,并更新客商审批状态
*/
submitCustomerApproval(id, fullName = '', approvalStatus = '') {
return submitMkApprovalFlow({
bizType: 'customer-archive',
formInstanceId: id,
subjectName: fullName,
approvalStatus,
}).then(() => submitApproval(id));
},
openReviewScore() {
const scores = this.archiveForm.scores || [];
if (!scores.length) {
this.$message.warning('暂无评分记录,无法复评');
return;
}
this.$nextTick(() => this.openScore(scores[0], 0));
},
addScore() {
if ((this.archiveForm.scores || []).length) {
this.$message.warning('请勿重复添加');
return;
}
this.scoreRecordIndex = -1;
this.currentScore = this.normalizeScore({});
this.currentScore = this.normalizeScore({ applyCreditLimit: '' });
this.scoreAttachmentFiles = [];
this.expandedScoreCategoryKeys = [];
this.scoreBox = true;
@@ -4332,7 +4501,7 @@ export default {
JSON.stringify(
(item.options || []).map(option => ({
label: option.label || option.optionName || option.value,
value: option.value || option.optionName || option.label,
value: option.value ?? option.optionName ?? option.label,
score: option.score,
changeType: option.changeType,
changeValue: option.changeValue,
@@ -4422,20 +4591,21 @@ export default {
const isScoreOption = item.changeType || item.changeValue || item.changeUnit;
const changeLabel = item.changeType === 'decrease' ? '每减少' : '每增加';
const scoreLabel = item.scoreType === 'subtract' ? '减' : '加';
const rawScore = item.score;
const generatedLabel = isScoreOption
? `${changeLabel}${item.changeValue || ''}${item.changeUnit || ''}${scoreLabel}${
item.score || ''
this.isBlankScore(rawScore) ? '' : rawScore
}分`
: '';
const label = item.label || item.optionName || item.value || generatedLabel;
return {
...item,
label,
value: item.value || item.optionName || item.label || generatedLabel,
value: item.value ?? item.optionName ?? item.label ?? generatedLabel,
score:
item.scoreType === 'subtract' && item.score !== undefined
? -Math.abs(Number(item.score))
: item.score,
item.scoreType === 'subtract' && !this.isBlankScore(rawScore)
? -Math.abs(Number(rawScore))
: rawScore,
};
});
if (Array.isArray(value)) return normalize(value);
@@ -4499,23 +4669,35 @@ export default {
const valid = increase ? input >= base : input <= base;
if (!valid) {
detail.selfScore = '';
this.$message.warning(`输入值${increase ? '不能小于' : '不能大于'}基准数值${base}`);
this.calculateScore(this.currentScore);
return;
}
detail.selfScore = this.getScoreTypeCalculatedScore(detail);
this.calculateScore(this.currentScore);
},
handleScoreValueBlur(detail) {
const normalized = String(detail.scoreInput ?? '').trim();
if (!normalized || normalized === '-' || normalized === '.') return;
const rule = this.getScoreRule(detail);
const base = Number(detail.baseValue);
const input = Number(normalized);
if (!rule || !Number.isFinite(base) || !Number.isFinite(input)) return;
const increase = rule.changeType !== 'decrease';
const valid = increase ? input >= base : input <= base;
if (!valid) {
this.$message.warning(`输入值${increase ? '不能小于' : '不能大于'}基准数值${base}`);
}
},
scoreOptionChange(detail, optionValue) {
const option = this.parseScoreOptions(detail.optionsJson).find(
item => item.value === optionValue
);
const score = Number(option?.score || 0);
detail.selfScore = score;
const rawScore = option?.score;
detail.selfScore = this.isBlankScore(rawScore) ? 0 : Number(rawScore);
this.calculateScore(this.currentScore);
},
handleScoreDetailScoreInput(detail, prop, value) {
const normalized = String(value || '')
const normalized = String(value ?? '')
.replace(/[^\d.]/g, '')
.replace(/^\./, '')
.replace(/(\..*)\./g, '$1')
@@ -4647,8 +4829,7 @@ export default {
sumScore(plusDetails, 'reviewScore') -
sumScore(minusDetails, 'reviewScore');
const hasReviewScore = details.some(
item =>
item.reviewScore !== undefined && item.reviewScore !== null && item.reviewScore !== ''
item => !this.isBlankScore(item.reviewScore)
);
const finalScore = hasReviewScore ? reviewScore : selfScore;
const fullMark = this.getScoreFullMark(details);
@@ -4668,13 +4849,17 @@ export default {
}
return score;
},
isBlankScore(value) {
return value === undefined || value === null || String(value).trim() === '';
},
hasIncompleteBasicScoreDetail(details = []) {
return this.getScoreCategoryDetailsByList(details, 'basic').some(item => {
if (this.isScoreTypeDetail(item)) {
const input = String(item.scoreInput ?? '').trim();
return !input || !Number.isFinite(Number(input)) || item.selfScore === '';
const inputBlank = input === '' || input === '-' || input === '.';
return inputBlank || !Number.isFinite(Number(input)) || this.isBlankScore(item.selfScore);
}
return !item.selectedOption;
return this.isBlankScore(item.selectedOption);
});
},
finishScore(score) {
@@ -4691,10 +4876,13 @@ export default {
score.reviewStatus = '已完成';
this.$message.success('评分已完成');
},
saveScoreDetail() {
saveScoreDetail(successMessage) {
if (!this.validateScoreForm(false)) return;
this.currentScore.attachments = JSON.parse(JSON.stringify(this.scoreAttachmentFiles || []));
this.currentScore.proofAttachments = this.stringifyAttachments(this.scoreAttachmentFiles);
this.currentScore.selfStatus = this.hasIncompleteBasicScoreDetail(this.currentScore.details)
? '未完成'
: '已完成';
this.calculateScore(this.currentScore);
const score = JSON.parse(JSON.stringify(this.currentScore));
if (this.scoreRecordIndex > -1) {
@@ -4706,23 +4894,62 @@ export default {
this.syncArchiveCreditFromScores();
this.activeTab = 'scores';
this.scoreBox = false;
this.saveScoreArchive();
},
saveScoreArchive() {
if (!this.archiveForm.id) {
this.$message.success('评分记录已添加,请保存客商档案后生效');
return;
const pending = this.saveScoreArchive(successMessage);
if (this.reviewMode && successMessage && pending && pending.then) {
pending.then(() => this.closeArchive());
}
submit(this.normalizeArchive()).then(() => {
this.$message.success('评分记录已保存');
return pending;
},
deleteScore(index) {
this.$confirm('确定删除该评分记录?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
if (!Array.isArray(this.archiveForm.scores)) this.archiveForm.scores = [];
this.archiveForm.scores.splice(index, 1);
if (this.scoreRecordIndex === index) {
this.scoreBox = false;
} else if (this.scoreRecordIndex > index) {
this.scoreRecordIndex -= 1;
}
const latestScore = this.getLatestCreditScore(this.archiveForm.scores);
if (latestScore) {
this.syncArchiveCreditFromScores();
} else {
this.archiveForm.customerLevel = '';
this.archiveForm.maxCreditLimit = '';
this.archiveForm.applyCreditLimit = '';
}
this.handleScoreCurrentChange(this.scorePage.currentPage);
this.saveScoreArchive('评分记录已删除', '评分记录已删除,请保存客商档案后生效');
})
.catch(() => {});
},
saveScoreArchive(
successMessage = '评分记录已保存',
draftMessage = '评分记录已添加,请保存客商档案后生效'
) {
if (!this.archiveForm.id) {
this.$message.success(draftMessage);
return Promise.resolve();
}
return submit(this.normalizeArchive()).then(() => {
this.$message.success(successMessage);
});
},
submitSelfScore() {
if (!this.validateScoreForm(true)) return;
this.currentScore.selfStatus = '已完成';
this.currentScore.reviewStatus = '未完成';
this.saveScoreDetail('自评已提交');
},
confirmReviewScore() {
if (!this.validateScoreForm(true)) return;
this.currentScore.selfStatus = '已完成';
this.currentScore.reviewStatus = '已完成';
this.saveScoreDetail();
this.$message.success('复评确认成功');
this.saveScoreDetail('复评确认成功');
},
validateScoreForm(requireComplete) {
if (!this.currentScore.scoreDate) {
@@ -4760,7 +4987,7 @@ export default {
if (
item.reviewScore === undefined ||
item.reviewScore === null ||
item.reviewScore === ''
String(item.reviewScore).trim() === ''
) {
return false;
}
@@ -4777,7 +5004,7 @@ export default {
return false;
}
if (requireComplete && this.hasIncompleteBasicScoreDetail(this.currentScore.details)) {
this.$message.warning('请完整填写基础得分项评分明细');
this.$message.warning('请完整填写所有基础项目后再提交自评');
return false;
}
return true;
@@ -4832,13 +5059,19 @@ export default {
getDetail(row.id).then(res => {
const archive = this.normalizeDetail(res.data.data);
archive.qualificationAttachments = archive.qualificationAttachments || '';
if (!this.validateFormalForApproval(archive)) return;
if (!this.validateScoreForApproval(archive)) return;
this.$confirm('是否提交客商准入审批?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => submitApproval(row.id))
.then(() =>
this.submitCustomerApproval(
row.id,
archive.fullName || row.fullName,
archive.approvalStatus || row.approvalStatus
)
)
.then(() => {
this.onLoad(this.page);
this.$message({ type: 'success', message: '提交成功!' });
@@ -4939,7 +5172,7 @@ export default {
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
this.$refs.crud?.toggleSelection();
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
@@ -5332,10 +5565,16 @@ export default {
}
:deep(.el-table__body td) {
//min-height: 112px;
color: #303133;
}
:deep(.score-item-name) {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
:deep(.el-select),
:deep(.el-input),
:deep(.el-select) {
@@ -5370,13 +5609,28 @@ export default {
.invoice-form {
max-width: none;
:deep(.el-input),
:deep(.el-cascader),
:deep(.el-select) {
width: 100%;
}
:deep(.el-cascader .el-input) {
width: 100%;
}
}
.invoice-contact-table {
width: 100%;
:deep(.el-input),
:deep(.el-select) {
:deep(.el-select),
:deep(.el-cascader) {
width: 100%;
}
:deep(.el-cascader .el-input) {
width: 100%;
}
}
@@ -5508,25 +5762,10 @@ export default {
word-break: break-word;
}
:deep(.change-record-detail-dialog .el-dialog__body) {
max-height: 65vh;
overflow: auto;
}
:deep(.change-record-detail-dialog .change-record-detail-value .cell) {
white-space: pre-wrap;
word-break: break-word;
overflow: visible;
text-overflow: clip;
line-height: 1.6;
}
.change-record-detail-meta {
display: flex;
gap: 32px;
margin-bottom: 16px;
color: #606266;
font-size: 14px;
.customer-archive-page.is-public-view {
:deep(.archive-page-form .archive-form__footer) {
left: 0;
}
}
.archive-page-form {
+26
View File
@@ -21,6 +21,15 @@
@on-load="onLoad"
>
<template #menu-left>
<el-button
v-if="hasPermission('equipment_ledger_delete')"
type="danger"
icon="el-icon-delete"
plain
@click="handleDelete"
>
批量删除
</el-button>
<el-button
v-if="hasPermission('equipment_ledger_import')"
type="primary"
@@ -310,6 +319,23 @@ export default {
this.$message.success('操作成功');
});
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning('请选择至少一条数据');
return;
}
this.$confirm('确认删除选中的数据?删除后将不可恢复!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => remove(this.ids))
.then(() => {
this.onLoad(this.page);
this.$message.success('操作成功');
this.$refs.crud.toggleSelection();
});
},
beforeOpen(done, type) {
this.boxType = type;
if (type === 'add') {

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