899a8c1c2b
- 票据账册搜索改用 el-check-tag 实现快捷筛选,提升用户交互体验 - 查询按钮增加图标,重置按钮同样添加图标及文字说明 - 调整票据搜索表单标签宽度由160px统一为88px,优化界面一致性 - 全站多处搜索栏表单标签宽度由160px改为88px,涵盖多页面及组件 - 修复业务组件内el-autocomplete输入框宽度适配,避免placeholder被裁剪 - 业务页面货物名称表格列宽由150调整为240,改善显示效果 - 修正系统部门操作列宽度避免按钮竖排溢出问题 - 修改多个表单页和搜索板块样式,确保标签宽度和对齐一致 - 调整表单按钮等样式,提升整体页面美观性和操作友好度
578 lines
16 KiB
Vue
578 lines
16 KiB
Vue
<template>
|
|
<basic-container class="exception-disposal-page">
|
|
<section class="exception-disposal-page__search">
|
|
<el-form :model="query" label-position="right" label-width="88px" @submit.prevent>
|
|
<div class="exception-disposal-page__search-grid">
|
|
<el-form-item v-for="field in visibleSearchFields" :key="field.prop" :label="field.label">
|
|
<el-date-picker
|
|
v-if="field.type === 'daterange'"
|
|
v-model="query[field.prop]"
|
|
type="daterange"
|
|
format="YYYY-MM-DD"
|
|
value-format="YYYY-MM-DD"
|
|
start-placeholder="请选择"
|
|
end-placeholder="请选择"
|
|
range-separator="-"
|
|
/>
|
|
<el-cascader
|
|
v-else-if="field.prop === 'exceptionType'"
|
|
v-model="query[field.prop]"
|
|
:options="field.options"
|
|
clearable
|
|
filterable
|
|
placeholder="全部"
|
|
:props="{ emitPath: false }"
|
|
/>
|
|
<el-select
|
|
v-else-if="field.type === 'select'"
|
|
v-model="query[field.prop]"
|
|
clearable
|
|
placeholder="全部"
|
|
>
|
|
<el-option
|
|
v-for="item in field.options"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
/>
|
|
</el-select>
|
|
<el-input v-else v-model="query[field.prop]" clearable placeholder="请输入" />
|
|
</el-form-item>
|
|
<div class="exception-disposal-page__search-actions">
|
|
<el-button type="primary" @click="handleSearch">查询</el-button>
|
|
<el-button @click="handleReset">重置</el-button>
|
|
<el-button text :icon="searchExpanded ? ArrowUp : ArrowDown" @click="toggleSearch">
|
|
{{ searchExpanded ? '收起' : '展开' }}
|
|
</el-button>
|
|
</div>
|
|
</div>
|
|
</el-form>
|
|
</section>
|
|
|
|
<section class="exception-disposal-page__table-panel">
|
|
<div class="exception-disposal-page__toolbar">
|
|
<div>
|
|
<el-button
|
|
v-if="permission.exception_disposal_batch_complete"
|
|
type="primary"
|
|
plain
|
|
@click="handleBatchComplete"
|
|
>
|
|
批量完成
|
|
</el-button>
|
|
</div>
|
|
<div class="exception-disposal-page__toolbar-right">
|
|
<el-tooltip content="刷新" placement="top">
|
|
<el-button :icon="Refresh" text @click="loadTable" />
|
|
</el-tooltip>
|
|
<el-tooltip content="表格密度" placement="top">
|
|
<el-button :icon="Rank" text @click="noop" />
|
|
</el-tooltip>
|
|
<el-tooltip content="列设置" placement="top">
|
|
<el-button :icon="Setting" text @click="noop" />
|
|
</el-tooltip>
|
|
</div>
|
|
</div>
|
|
|
|
<el-table
|
|
v-loading="loading"
|
|
:data="rows"
|
|
border
|
|
class="exception-disposal-page__table"
|
|
@selection-change="handleSelectionChange"
|
|
>
|
|
<el-table-column type="selection" width="52" fixed="left" align="center" />
|
|
<el-table-column type="index" label="序号" width="72" fixed="left" align="center" />
|
|
<el-table-column
|
|
v-for="column in tableColumns"
|
|
:key="column.prop"
|
|
:prop="column.prop"
|
|
:label="column.label"
|
|
:min-width="column.minWidth"
|
|
align="center"
|
|
show-overflow-tooltip
|
|
>
|
|
<template #default="{ row }">
|
|
<el-link v-if="column.link && row[column.prop]" type="primary" @click="openWaybill(row)">
|
|
{{ row[column.prop] }}
|
|
</el-link>
|
|
<el-link
|
|
v-else-if="column.prop === 'disposalStatusName'"
|
|
:type="statusLinkType(row.disposalStatus)"
|
|
@click="openDisposal(row, row.disposalStatus === 'completed' ? 'detail' : 'follow')"
|
|
>
|
|
{{ row[column.prop] || '-' }}
|
|
</el-link>
|
|
<span v-else>{{ row[column.prop] || '-' }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作" width="180" fixed="right" align="center">
|
|
<template #default="{ row }">
|
|
<div class="exception-disposal-page__actions">
|
|
<template v-if="row.disposalStatus !== 'completed'">
|
|
<el-link
|
|
v-if="permission.exception_disposal_follow"
|
|
type="primary"
|
|
@click="openDisposal(row, 'follow')"
|
|
>
|
|
跟进
|
|
</el-link>
|
|
<el-link
|
|
v-if="permission.exception_disposal_complete"
|
|
type="primary"
|
|
@click="completeRow(row)"
|
|
>
|
|
完成
|
|
</el-link>
|
|
</template>
|
|
<el-link
|
|
v-else-if="permission.exception_disposal_view"
|
|
type="primary"
|
|
@click="openDisposal(row, 'detail')"
|
|
>
|
|
详情
|
|
</el-link>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div class="exception-disposal-page__pagination">
|
|
<el-pagination
|
|
v-model:current-page="page.current"
|
|
v-model:page-size="page.size"
|
|
:total="page.total"
|
|
:page-sizes="[10, 20, 50, 100]"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
@current-change="loadTable"
|
|
@size-change="handleSizeChange"
|
|
/>
|
|
</div>
|
|
</section>
|
|
|
|
<el-dialog
|
|
v-model="dialog.visible"
|
|
:title="dialog.mode === 'detail' ? '异常详情' : '异常跟进'"
|
|
width="960px"
|
|
append-to-body
|
|
destroy-on-close
|
|
>
|
|
<div v-loading="dialog.loading" class="exception-disposal-page__dialog">
|
|
<div class="dialog-section-title">异常信息</div>
|
|
<dl class="exception-disposal-page__detail-grid">
|
|
<template v-for="field in detailFields" :key="field.prop">
|
|
<div :class="{ 'is-wide': field.span === 2 }">
|
|
<dt>{{ field.label }}</dt>
|
|
<dd>
|
|
<el-link v-if="field.link && detail[field.prop]" type="primary">
|
|
{{ detail[field.prop] }}
|
|
</el-link>
|
|
<span v-else>{{ detail[field.prop] || '-' }}</span>
|
|
</dd>
|
|
</div>
|
|
</template>
|
|
</dl>
|
|
|
|
<div class="dialog-section-title">现场照片</div>
|
|
<div class="exception-disposal-page__photos">
|
|
<el-image
|
|
v-for="(url, index) in photoUrls"
|
|
:key="url"
|
|
:src="url"
|
|
:preview-src-list="photoUrls"
|
|
:initial-index="index"
|
|
fit="cover"
|
|
/>
|
|
<el-empty v-if="!photoUrls.length" description="暂无现场照片" :image-size="56" />
|
|
</div>
|
|
|
|
<el-form
|
|
v-if="dialog.mode === 'follow'"
|
|
ref="followFormRef"
|
|
:model="followForm"
|
|
:rules="followRules"
|
|
label-position="right"
|
|
label-width="auto"
|
|
class="exception-disposal-page__follow-form"
|
|
>
|
|
<el-form-item label="跟进说明" prop="followContent">
|
|
<el-input
|
|
v-model="followForm.followContent"
|
|
type="textarea"
|
|
maxlength="500"
|
|
show-word-limit
|
|
:rows="2"
|
|
placeholder="请输入"
|
|
/>
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<div class="dialog-section-title">历史跟进</div>
|
|
<el-table :data="detail.followRecords || []" border>
|
|
<el-table-column type="index" label="序号" width="70" align="center" />
|
|
<el-table-column
|
|
v-for="column in followColumns"
|
|
:key="column.prop"
|
|
:prop="column.prop"
|
|
:label="column.label"
|
|
:min-width="column.minWidth"
|
|
align="center"
|
|
show-overflow-tooltip
|
|
/>
|
|
</el-table>
|
|
</div>
|
|
<template #footer>
|
|
<el-button
|
|
v-if="dialog.mode === 'follow' && permission.exception_disposal_follow"
|
|
type="primary"
|
|
:loading="dialog.submitting"
|
|
@click="submitFollow"
|
|
>
|
|
提交
|
|
</el-button>
|
|
<el-button
|
|
v-if="dialog.mode === 'follow' && permission.exception_disposal_complete"
|
|
type="primary"
|
|
plain
|
|
@click="completeFromDialog"
|
|
>
|
|
完成
|
|
</el-button>
|
|
<el-button @click="dialog.visible = false">取消</el-button>
|
|
</template>
|
|
</el-dialog>
|
|
</basic-container>
|
|
</template>
|
|
|
|
<script>
|
|
import { ArrowDown, ArrowUp, Rank, Refresh, Setting } from '@element-plus/icons-vue';
|
|
import { mapGetters } from 'vuex';
|
|
import {
|
|
detailFields,
|
|
disposalStatusOptions,
|
|
exceptionCategoryOptions,
|
|
followColumns,
|
|
searchFields,
|
|
tableColumns,
|
|
} from '@/option/transit/exception-disposal';
|
|
import * as api from '@/api/transit/exception-disposal';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
Rank,
|
|
Refresh,
|
|
Setting,
|
|
ArrowDown,
|
|
ArrowUp,
|
|
searchFields,
|
|
tableColumns,
|
|
detailFields,
|
|
followColumns,
|
|
loading: false,
|
|
query: {},
|
|
rows: [],
|
|
selection: [],
|
|
searchExpanded: false,
|
|
page: { current: 1, size: 10, total: 0 },
|
|
dialog: { visible: false, mode: 'follow', loading: false, submitting: false },
|
|
detail: {},
|
|
followForm: { followContent: '' },
|
|
followRules: {
|
|
followContent: [
|
|
{ required: true, message: '请输入跟进说明', trigger: 'blur' },
|
|
{ max: 500, message: '跟进说明不能超过500个字符', trigger: 'blur' },
|
|
],
|
|
},
|
|
};
|
|
},
|
|
computed: {
|
|
...mapGetters(['permission']),
|
|
visibleSearchFields() {
|
|
return this.searchExpanded ? this.searchFields : this.searchFields.slice(0, 4);
|
|
},
|
|
photoUrls() {
|
|
return this.parsePhotos(this.detail.scenePhotos);
|
|
},
|
|
},
|
|
mounted() {
|
|
this.loadTable();
|
|
},
|
|
methods: {
|
|
async loadTable() {
|
|
this.loading = true;
|
|
try {
|
|
const res = await api.getList(this.page.current, this.page.size, this.buildQuery());
|
|
const data = this.unwrapPage(res);
|
|
this.rows = (data.records || []).map(this.decorateRow);
|
|
this.page.total = data.total || 0;
|
|
} finally {
|
|
this.loading = false;
|
|
}
|
|
},
|
|
buildQuery() {
|
|
const params = { ...this.query };
|
|
if (Array.isArray(params.reportTimeRange)) {
|
|
params.reportStartTime = params.reportTimeRange[0];
|
|
params.reportEndTime = params.reportTimeRange[1];
|
|
}
|
|
delete params.reportTimeRange;
|
|
return params;
|
|
},
|
|
handleSearch() {
|
|
this.page.current = 1;
|
|
this.loadTable();
|
|
},
|
|
handleReset() {
|
|
this.query = {};
|
|
this.handleSearch();
|
|
},
|
|
toggleSearch() {
|
|
this.searchExpanded = !this.searchExpanded;
|
|
},
|
|
handleSizeChange() {
|
|
this.page.current = 1;
|
|
this.loadTable();
|
|
},
|
|
handleSelectionChange(selection) {
|
|
this.selection = selection;
|
|
},
|
|
async openDisposal(row, mode) {
|
|
this.dialog = { visible: true, mode, loading: true, submitting: false };
|
|
this.followForm = { followContent: '' };
|
|
try {
|
|
const res = await api.getDetail(row.id);
|
|
this.detail = this.decorateRow(res.data?.data || res.data || res || {});
|
|
} finally {
|
|
this.dialog.loading = false;
|
|
}
|
|
},
|
|
async submitFollow() {
|
|
await this.$refs.followFormRef.validate();
|
|
this.dialog.submitting = true;
|
|
try {
|
|
await api.follow({ id: this.detail.id, followContent: this.followForm.followContent });
|
|
this.$message.success('跟进成功');
|
|
this.dialog.visible = false;
|
|
this.loadTable();
|
|
} finally {
|
|
this.dialog.submitting = false;
|
|
}
|
|
},
|
|
async completeRow(row) {
|
|
await this.$confirm('确认完成该异常处置?', '提示', { type: 'warning' });
|
|
await api.complete({ id: row.id });
|
|
this.$message.success('完成成功');
|
|
this.loadTable();
|
|
},
|
|
async completeFromDialog() {
|
|
await this.$confirm('确认完成该异常处置?', '提示', { type: 'warning' });
|
|
await api.complete({ id: this.detail.id });
|
|
this.$message.success('完成成功');
|
|
this.dialog.visible = false;
|
|
this.loadTable();
|
|
},
|
|
async handleBatchComplete() {
|
|
if (!this.selection.length) {
|
|
this.$message.warning('请选择需要完成的异常');
|
|
return;
|
|
}
|
|
await this.$confirm('确认批量完成已选择的异常处置?', '提示', { type: 'warning' });
|
|
await api.batchComplete(this.selection.map(item => item.id).join(','));
|
|
this.$message.success('批量完成成功');
|
|
this.loadTable();
|
|
},
|
|
openWaybill(row) {
|
|
if (row.waybillId) {
|
|
this.$router.push({ path: '/business/waybill-manage', query: { detailId: row.waybillId } });
|
|
}
|
|
},
|
|
decorateRow(row) {
|
|
return {
|
|
...row,
|
|
exceptionTypeName: this.exceptionName(row.exceptionType),
|
|
disposalStatusName:
|
|
disposalStatusOptions.find(item => item.value === row.disposalStatus)?.label ||
|
|
row.disposalStatus ||
|
|
'-',
|
|
};
|
|
},
|
|
exceptionName(value) {
|
|
for (const group of exceptionCategoryOptions) {
|
|
const match = group.children.find(item => item.value === value);
|
|
if (match) return match.label;
|
|
}
|
|
return value || '-';
|
|
},
|
|
statusLinkType(status) {
|
|
return status === 'completed' ? 'info' : 'primary';
|
|
},
|
|
parsePhotos(value) {
|
|
if (!value) return [];
|
|
try {
|
|
const parsed = JSON.parse(value);
|
|
if (Array.isArray(parsed)) return parsed.filter(Boolean);
|
|
} catch (error) {
|
|
return String(value)
|
|
.split(',')
|
|
.map(item => item.trim())
|
|
.filter(Boolean);
|
|
}
|
|
return [];
|
|
},
|
|
unwrapPage(res) {
|
|
const data = res.data?.data || res.data || res || {};
|
|
return data.records ? data : { records: [], total: 0 };
|
|
},
|
|
noop() {},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.exception-disposal-page {
|
|
color: #303133;
|
|
}
|
|
|
|
.exception-disposal-page__search {
|
|
margin-bottom: 8px;
|
|
padding: 12px 12px 4px;
|
|
background: #fff;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
|
|
|
:deep(.el-form-item__label) {
|
|
min-width: 88px;
|
|
white-space: nowrap;
|
|
}
|
|
}
|
|
|
|
.exception-disposal-page__search-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(4, minmax(220px, 1fr));
|
|
gap: 8px 24px;
|
|
|
|
:deep(.el-form-item) {
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
:deep(.el-input),
|
|
:deep(.el-select),
|
|
:deep(.el-cascader),
|
|
:deep(.el-date-editor) {
|
|
width: 100%;
|
|
}
|
|
}
|
|
|
|
.exception-disposal-page__search-actions {
|
|
grid-column: 1 / -1;
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
gap: 8px;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.exception-disposal-page__table-panel {
|
|
//background: #fff;
|
|
}
|
|
|
|
.exception-disposal-page__toolbar {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 12px 0;
|
|
}
|
|
|
|
.exception-disposal-page__toolbar-right,
|
|
.exception-disposal-page__actions {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.exception-disposal-page__table {
|
|
--el-table-border-color: #eff1f7;
|
|
|
|
:deep(th.el-table__cell) {
|
|
background: #f5f7fa;
|
|
}
|
|
|
|
:deep(.el-table__row:nth-child(even) td.el-table__cell) {
|
|
background: #fafafa;
|
|
}
|
|
}
|
|
|
|
.exception-disposal-page__pagination {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
padding: 16px 0;
|
|
}
|
|
|
|
.exception-disposal-page__dialog {
|
|
padding: 4px 0 0;
|
|
}
|
|
|
|
.dialog-section-title {
|
|
margin: 12px 0;
|
|
padding-left: 12px;
|
|
border-left: 4px solid #409eff;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.exception-disposal-page__detail-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
gap: 12px 24px;
|
|
margin: 0;
|
|
|
|
div {
|
|
display: grid;
|
|
grid-template-columns: 120px minmax(0, 1fr);
|
|
align-items: start;
|
|
}
|
|
|
|
.is-wide {
|
|
grid-column: 1 / -1;
|
|
}
|
|
|
|
dt {
|
|
color: #606266;
|
|
text-align: right;
|
|
}
|
|
|
|
dd {
|
|
margin: 0 0 0 12px;
|
|
word-break: break-all;
|
|
}
|
|
}
|
|
|
|
.exception-disposal-page__photos {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 12px;
|
|
min-height: 80px;
|
|
|
|
:deep(.el-image) {
|
|
width: 96px;
|
|
height: 96px;
|
|
border: 1px solid #eff1f7;
|
|
}
|
|
}
|
|
|
|
.exception-disposal-page__follow-form {
|
|
margin-top: 16px;
|
|
}
|
|
|
|
@media screen and (max-width: 1200px) {
|
|
.exception-disposal-page__search-grid {
|
|
grid-template-columns: repeat(2, minmax(220px, 1fr));
|
|
}
|
|
}
|
|
|
|
@media screen and (max-width: 760px) {
|
|
.exception-disposal-page__search-grid,
|
|
.exception-disposal-page__detail-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
}
|
|
</style>
|