提交
This commit is contained in:
1 parent
d84f4b944c
commit
7c838cfb2d
249 files changed
+50600
-18556
No files matched your search
@@ -91,15 +91,34 @@
|
||||
<el-button class="btn-main" type="primary" @click="openAdd">
|
||||
<el-icon><Plus /></el-icon>新增备用金申请
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleToolbarEdit">
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1 || !isDraftEditable(selectedRows[0])"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="
|
||||
selectedRows.length === 0 ||
|
||||
!selectedRows.every(isDraftEditable) ||
|
||||
!allRowsDeletableByCreator(selectedRows)
|
||||
"
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loadingMap.submit" @click="handleToolbarSubmit">
|
||||
<el-icon><Upload /></el-icon>提交审批
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="openFlowDialog()">
|
||||
<el-icon><View /></el-icon>查看审批流
|
||||
</el-button>
|
||||
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -114,6 +133,7 @@
|
||||
:summary-method="summaryMethod"
|
||||
:max-height="'min(520px, calc(100vh - 300px))'"
|
||||
@selection-change="onSelectionChange"
|
||||
@row-dblclick="openView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
@@ -132,7 +152,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="applicantName"
|
||||
label="申请人"
|
||||
@@ -202,38 +226,6 @@
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="360" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px; flex-wrap: nowrap">
|
||||
<el-button class="btn-op-item" @click="openView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'draft' || row.status === 'rejected'"
|
||||
class="btn-op-item"
|
||||
@click="openEdit(row)"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'draft' || row.status === 'rejected'"
|
||||
class="btn-op-item"
|
||||
:loading="loadingMap[`submit_${row.id}`]"
|
||||
@click="handleSubmit(row)"
|
||||
>
|
||||
<el-icon><Upload /></el-icon>提交
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="(row.status === 'draft' || row.status === 'rejected') && canDeleteByCreator(row)"
|
||||
class="btn-op-item"
|
||||
:loading="loadingMap[`del_${row.id}`]"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -312,6 +304,27 @@
|
||||
<p class="dlg-view-meta">
|
||||
申请金额(元):<b class="money-em">{{ formatMoneyYuan(viewData.amount || 0) }}</b>
|
||||
</p>
|
||||
<div v-if="isDraftEditable(viewData)" class="dlg-view-hero-actions">
|
||||
<el-button class="btn-main" type="primary" @click="openEdit(viewData)">
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:loading="loadingMap[`submit_${viewData.id}`]"
|
||||
@click="handleViewSubmit"
|
||||
>
|
||||
<el-icon><Upload /></el-icon>提交
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canDeleteByCreator(viewData)"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:loading="loadingMap[`del_${viewData.id}`]"
|
||||
@click="handleViewDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
@@ -416,6 +429,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { reactive, ref, computed, onMounted, nextTick, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
@@ -433,7 +447,7 @@ import {
|
||||
ArrowDownBold
|
||||
} from '@element-plus/icons-vue'
|
||||
import { advanceApi, paymentApi } from '@/api/bx'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { canDeleteByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import {
|
||||
statusLabel,
|
||||
statusTagType,
|
||||
@@ -602,6 +616,11 @@ function handleReset() {
|
||||
search()
|
||||
}
|
||||
|
||||
function isDraftEditable(row?: any) {
|
||||
if (!row) return false
|
||||
return row.status === 'draft' || row.status === 'rejected'
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length === 0) {
|
||||
ElMessage.warning('请先勾选要编辑的申请')
|
||||
@@ -615,6 +634,55 @@ function handleToolbarEdit() {
|
||||
openEdit(row)
|
||||
}
|
||||
|
||||
async function handleToolbarDelete() {
|
||||
if (selectedRows.value.length === 0) {
|
||||
ElMessage.warning('请先勾选要删除的申请')
|
||||
return
|
||||
}
|
||||
const targets = selectedRows.value.filter(isDraftEditable)
|
||||
if (targets.length !== selectedRows.value.length) {
|
||||
ElMessage.warning('仅草稿或已驳回的申请可删除')
|
||||
return
|
||||
}
|
||||
if (!allRowsDeletableByCreator(targets)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(`确定删除选中的 ${targets.length} 条申请吗?删除后不可恢复。`, '删除确认', {
|
||||
confirmButtonText: '确定删除',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
for (const row of targets) {
|
||||
await advanceApi.delete(row.id)
|
||||
}
|
||||
ElMessage.success('删除成功')
|
||||
await refreshListAndStats()
|
||||
} catch (e: any) {
|
||||
if (e !== 'cancel') {
|
||||
ElMessage.error(e?.message || '删除失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function handleViewSubmit() {
|
||||
if (!viewData.value?.id) return
|
||||
await handleSubmit(viewData.value)
|
||||
try {
|
||||
const res = await advanceApi.getById(viewData.value.id)
|
||||
viewData.value = res.data || res
|
||||
} catch {
|
||||
dialogs.view = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleViewDelete() {
|
||||
if (!viewData.value?.id) return
|
||||
await handleDelete(viewData.value)
|
||||
dialogs.view = false
|
||||
}
|
||||
|
||||
function openAdd() {
|
||||
Object.assign(addForm, { reason: '', amount: '', remark: '' })
|
||||
editingId.value = null
|
||||
|
||||
@@ -14,8 +14,11 @@
|
||||
<h2 class="title-bar-heading">备用金审批</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-tabs">
|
||||
<el-tabs v-model="activeTab" @tab-change="handleTabChange">
|
||||
<el-tabs
|
||||
v-model="activeTab"
|
||||
class="panel-pill-tabs panel-pill-tabs--lg"
|
||||
@tab-change="handleTabChange"
|
||||
>
|
||||
<!-- 待我审批 -->
|
||||
<el-tab-pane label="待我审批" name="pending">
|
||||
<div class="filter-block">
|
||||
@@ -70,6 +73,8 @@
|
||||
<el-button class="btn-ghost" @click="handleBatchReject">
|
||||
<el-icon><Close /></el-icon>驳回
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="pendingLoading" @refresh="refreshPending" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -84,6 +89,7 @@
|
||||
:summary-method="pendingSummaryMethod"
|
||||
:max-height="'min(520px, calc(100vh - 300px))'"
|
||||
@selection-change="onSelectionChange"
|
||||
@row-dblclick="openView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
@@ -102,7 +108,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="reason"
|
||||
@@ -133,21 +143,6 @@
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="280" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px; flex-wrap: nowrap">
|
||||
<el-button class="btn-op-item" @click="openView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="openApproveDialog([row], 'approve')">
|
||||
<el-icon><Check /></el-icon>通过
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="openApproveDialog([row], 'reject')">
|
||||
<el-icon><Close /></el-icon>驳回
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -218,6 +213,7 @@
|
||||
show-summary
|
||||
:summary-method="approvedSummaryMethod"
|
||||
:max-height="'min(520px, calc(100vh - 300px))'"
|
||||
@row-dblclick="openView"
|
||||
>
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
@@ -235,7 +231,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="reason"
|
||||
@@ -273,13 +273,6 @@
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="120" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item" @click="openView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -297,7 +290,6 @@
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 详情 -->
|
||||
@@ -322,6 +314,14 @@
|
||||
<p class="dlg-view-meta">
|
||||
申请金额(元):<b class="money-em">{{ formatMoneyYuan(viewData.amount || 0) }}</b>
|
||||
</p>
|
||||
<div v-if="activeTab === 'pending'" class="dlg-view-hero-actions">
|
||||
<el-button class="btn-main" type="primary" @click="openApproveDialog([viewData], 'approve')">
|
||||
<el-icon><Check /></el-icon>通过
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="openApproveDialog([viewData], 'reject')">
|
||||
<el-icon><Close /></el-icon>驳回
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
@@ -393,8 +393,9 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, computed, onMounted } from 'vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Check, Close, View, Search, RefreshLeft } from '@element-plus/icons-vue'
|
||||
import { Check, Close, Search, RefreshLeft } from '@element-plus/icons-vue'
|
||||
import { advanceApi } from '@/api/bx'
|
||||
import { advanceApproverStats, refreshApproveMenuBadges } from '@/hooks/bx/useApproveMenuBadge'
|
||||
import { useMenuStore } from '@/store/modules/menu'
|
||||
|
||||
@@ -14,8 +14,11 @@
|
||||
<h2 class="title-bar-heading">备用金发放</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-tabs">
|
||||
<el-tabs v-model="activeTab" @tab-change="handleTabChange">
|
||||
<el-tabs
|
||||
v-model="activeTab"
|
||||
class="panel-pill-tabs panel-pill-tabs--lg"
|
||||
@tab-change="handleTabChange"
|
||||
>
|
||||
<el-tab-pane label="待发放" name="pending">
|
||||
<div class="filter-block">
|
||||
<el-form :model="filterForm" class="filter-form" @submit.prevent>
|
||||
@@ -69,6 +72,8 @@
|
||||
<el-button class="btn-ghost" :loading="loadingMap.export" @click="handleExport">
|
||||
<el-icon><Download /></el-icon>导出
|
||||
</el-button>
|
||||
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -83,6 +88,7 @@
|
||||
:summary-method="advanceIssueSummary"
|
||||
:max-height="'min(520px, calc(100vh - 360px))'"
|
||||
@selection-change="onSelectionChange"
|
||||
@row-dblclick="openView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
@@ -101,7 +107,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="reason"
|
||||
@@ -154,18 +164,6 @@
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="操作" min-width="280" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px; flex-wrap: nowrap">
|
||||
<el-button class="btn-op-item" @click="openIssueDialog(row)">
|
||||
<el-icon><Check /></el-icon>标记发放
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="openView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -230,6 +228,8 @@
|
||||
<el-button class="btn-ghost" :loading="loadingMap.export" @click="handleExport">
|
||||
<el-icon><Download /></el-icon>导出
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -243,6 +243,7 @@
|
||||
show-summary
|
||||
:summary-method="advanceIssueSummary"
|
||||
:max-height="'min(520px, calc(100vh - 360px))'"
|
||||
@row-dblclick="openView"
|
||||
>
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
@@ -260,7 +261,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="reason"
|
||||
@@ -307,13 +312,6 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="issueTime" label="发放时间" min-width="140" align="center" header-align="center" />
|
||||
<el-table-column prop="issueUserName" label="发放操作人" min-width="110" align="center" header-align="center" />
|
||||
<el-table-column label="操作" min-width="120" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item" @click="openView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -331,7 +329,6 @@
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 标记发放 -->
|
||||
@@ -404,6 +401,11 @@
|
||||
实际发放金额(元):<b class="money-em">{{ formatMoneyYuan(viewData.actualAmount) }}</b>
|
||||
</template>
|
||||
</p>
|
||||
<div v-if="activeTab === 'pending'" class="dlg-view-hero-actions">
|
||||
<el-button class="btn-main" type="primary" @click="openIssueDialog(viewData)">
|
||||
<el-icon><Check /></el-icon>标记发放
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
@@ -460,9 +462,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { reactive, ref, computed, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Check, Download, View, Close, Search, RefreshLeft } from '@element-plus/icons-vue'
|
||||
import { Check, Download, Close, Search, RefreshLeft } from '@element-plus/icons-vue'
|
||||
import { paymentApi, advanceApi } from '@/api/bx'
|
||||
import { type BxAttachmentItem, loadBxAttachments } from '@/utils/bx/attachment'
|
||||
import { formatSumMoney, formatMoney, formatMoneyYuan, moneyTableFormatter } from '@/utils/bx/format'
|
||||
|
||||
@@ -46,17 +46,45 @@
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">0</span> 项
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button class="btn-main" type="primary" @click="openAddDialog">
|
||||
<el-icon><Plus /></el-icon>新增一级项目
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
:loading="loadingMap.rowEdit"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedRows.length === 1 && selectedRows[0]?.level === 1"
|
||||
class="btn-ghost"
|
||||
:loading="loadingMap.rowAddChild"
|
||||
@click="handleToolbarAddChild"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>新增子项
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
:loading="loadingMap.rowDelete"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="expandAll">
|
||||
<el-icon><SortDown /></el-icon>展开全部
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="collapseAll">
|
||||
<el-icon><SortUp /></el-icon>收起全部
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -69,7 +97,9 @@
|
||||
stripe
|
||||
row-key="id"
|
||||
:tree-props="{ children: 'children', hasChildren: 'childCount > 0' }"
|
||||
@selection-change="onSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="itemName"
|
||||
@@ -110,32 +140,6 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="280" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px; flex-wrap: nowrap">
|
||||
<el-button class="btn-op-item" :loading="loadingMap.rowEdit" @click="openEditDialog(row)">
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.level === 1"
|
||||
class="btn-op-item"
|
||||
:loading="loadingMap.rowAddChild"
|
||||
@click="openAddChildDialog(row)"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>新增子项
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item"
|
||||
:disabled="!canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
:loading="loadingMap.rowDelete"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</section>
|
||||
@@ -316,6 +320,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { reactive, ref, onMounted, computed, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
@@ -353,6 +358,7 @@ const searchForm = reactive({
|
||||
|
||||
const expenseTree = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const selectedRows = ref<any[]>([])
|
||||
|
||||
const formData = reactive({
|
||||
id: 0 as number,
|
||||
@@ -447,6 +453,34 @@ function openAddDialog() {
|
||||
dialogs.addProject = true
|
||||
}
|
||||
|
||||
function onSelectionChange(rows: any[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条费用项目')
|
||||
return
|
||||
}
|
||||
openEditDialog(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarAddChild() {
|
||||
if (selectedRows.value.length !== 1 || selectedRows.value[0]?.level !== 1) {
|
||||
ElMessage.warning('请先勾选一条一级项目')
|
||||
return
|
||||
}
|
||||
openAddChildDialog(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条费用项目')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function openEditDialog(row: any) {
|
||||
Object.assign(formData, {
|
||||
id: row.id,
|
||||
|
||||
@@ -14,8 +14,11 @@
|
||||
<h2 class="title-bar-heading">支付管理</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-tabs">
|
||||
<el-tabs v-model="activeTab" @tab-change="handleTabChange">
|
||||
<el-tabs
|
||||
v-model="activeTab"
|
||||
class="panel-pill-tabs panel-pill-tabs--lg"
|
||||
@tab-change="handleTabChange"
|
||||
>
|
||||
<!-- 待处理 -->
|
||||
<el-tab-pane label="待处理" name="pending">
|
||||
<div class="filter-block">
|
||||
@@ -70,6 +73,8 @@
|
||||
<el-button class="btn-ghost" @click="handleToolbarOffset">
|
||||
<el-icon><Switch /></el-icon>冲抵备用金
|
||||
</el-button>
|
||||
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -84,6 +89,7 @@
|
||||
:summary-method="summaryMethod"
|
||||
:max-height="'min(520px, calc(100vh - 360px))'"
|
||||
@selection-change="onSelectionChange"
|
||||
@row-dblclick="openView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
@@ -102,7 +108,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="title"
|
||||
@@ -135,21 +145,6 @@
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="280" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px; flex-wrap: nowrap">
|
||||
<el-button class="btn-op-item" @click="openView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="openIssueDialog(row)">
|
||||
<el-icon><Money /></el-icon>发放
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="openOffsetDialog(row)">
|
||||
<el-icon><Switch /></el-icon>冲抵
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -230,6 +225,7 @@
|
||||
show-summary
|
||||
:summary-method="processedSummaryMethod"
|
||||
:max-height="'min(520px, calc(100vh - 300px))'"
|
||||
@row-dblclick="openProcessedView"
|
||||
>
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
@@ -247,7 +243,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openProcessedView(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="title"
|
||||
@@ -292,13 +292,6 @@
|
||||
{{ row.payTime || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="120" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item" @click="openProcessedView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -316,7 +309,6 @@
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 单据详情 -->
|
||||
@@ -341,6 +333,14 @@
|
||||
<p class="dlg-view-meta">
|
||||
金额(元):<b class="money-em">{{ formatMoneyYuan(viewData.amount || 0) }}</b>
|
||||
</p>
|
||||
<div v-if="activeTab === 'pending'" class="dlg-view-hero-actions">
|
||||
<el-button class="btn-main" type="primary" @click="openIssueDialog(viewData)">
|
||||
<el-icon><Money /></el-icon>发放
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="openOffsetDialog(viewData)">
|
||||
<el-icon><Switch /></el-icon>冲抵备用金
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||||
@@ -599,6 +599,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { reactive, ref, computed, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
@@ -1174,18 +1175,3 @@ function processedStatusTagType(
|
||||
return 'info'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dialog-section-title {
|
||||
margin: 0 0 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text, #1e293b);
|
||||
}
|
||||
|
||||
.offset-pager {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -63,12 +63,34 @@
|
||||
<el-button class="btn-main" type="primary" @click="openAddDialog">
|
||||
<el-icon><Plus /></el-icon>新增报销申请
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1 || !isDraftEditable(selectedRows[0])"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="
|
||||
selectedRows.length === 0 ||
|
||||
!selectedRows.every(isDraftEditable) ||
|
||||
!allRowsDeletableByCreator(selectedRows)
|
||||
"
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loadingMap.submit" @click="handleToolbarSubmit">
|
||||
<el-icon><Upload /></el-icon>提交审批
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="openFlowDialog()">
|
||||
<el-icon><View /></el-icon>查看审批流
|
||||
</el-button>
|
||||
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -83,6 +105,7 @@
|
||||
:summary-method="summaryMethod"
|
||||
:max-height="'min(520px, calc(100vh - 300px))'"
|
||||
@selection-change="onSelectionChange"
|
||||
@row-dblclick="openView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
@@ -101,7 +124,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="title"
|
||||
label="报销标题"
|
||||
@@ -146,38 +173,6 @@
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="360" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px; flex-wrap: nowrap">
|
||||
<el-button class="btn-op-item" @click="openView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'draft' || row.status === 'rejected'"
|
||||
class="btn-op-item"
|
||||
@click="openEditDialog(row)"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'draft' || row.status === 'rejected'"
|
||||
class="btn-op-item"
|
||||
:loading="loadingMap[`submit_${row.id}`]"
|
||||
@click="handleSubmit(row)"
|
||||
>
|
||||
<el-icon><Upload /></el-icon>提交
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="(row.status === 'draft' || row.status === 'rejected') && canDeleteByCreator(row)"
|
||||
class="btn-op-item"
|
||||
:loading="loadingMap[`del_${row.id}`]"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -342,6 +337,27 @@
|
||||
<p class="dlg-view-meta">
|
||||
报销金额(元):<b class="money-em">{{ formatMoneyYuan(viewData.amount || 0) }}</b>
|
||||
</p>
|
||||
<div v-if="isDraftEditable(viewData)" class="dlg-view-hero-actions">
|
||||
<el-button class="btn-main" type="primary" @click="openEditDialog(viewData)">
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:loading="loadingMap[`submit_${viewData.id}`]"
|
||||
@click="handleViewSubmit"
|
||||
>
|
||||
<el-icon><Upload /></el-icon>提交
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canDeleteByCreator(viewData)"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:loading="loadingMap[`del_${viewData.id}`]"
|
||||
@click="handleViewDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
@@ -459,6 +475,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { reactive, ref, computed, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
@@ -474,7 +491,7 @@ import {
|
||||
} from '@element-plus/icons-vue'
|
||||
import { reimburseApi, attachmentApi } from '@/api/bx'
|
||||
import { type BxAttachmentItem, loadBxAttachments } from '@/utils/bx/attachment'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { canDeleteByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { useExpenseItemTree, type ExpenseItem } from '@/hooks/bx/useExpenseItemTree'
|
||||
import {
|
||||
statusLabel,
|
||||
@@ -676,6 +693,68 @@ async function openAddDialog() {
|
||||
await refreshGeneratedTitle()
|
||||
}
|
||||
|
||||
function isDraftEditable(row?: any) {
|
||||
if (!row) return false
|
||||
return row.status === 'draft' || row.status === 'rejected'
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条报销单')
|
||||
return
|
||||
}
|
||||
openEditDialog(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleToolbarDelete() {
|
||||
if (selectedRows.value.length === 0) {
|
||||
ElMessage.warning('请先勾选要删除的报销单')
|
||||
return
|
||||
}
|
||||
const targets = selectedRows.value.filter(isDraftEditable)
|
||||
if (targets.length !== selectedRows.value.length) {
|
||||
ElMessage.warning('仅草稿或已驳回的报销单可删除')
|
||||
return
|
||||
}
|
||||
if (!allRowsDeletableByCreator(targets)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(`确定删除选中的 ${targets.length} 条报销单吗?删除后不可恢复。`, '删除确认', {
|
||||
confirmButtonText: '确定删除',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
for (const row of targets) {
|
||||
await reimburseApi.delete(row.id)
|
||||
}
|
||||
ElMessage.success('删除成功')
|
||||
await refreshListAndStats()
|
||||
} catch (e: any) {
|
||||
if (e !== 'cancel') {
|
||||
ElMessage.error(e?.message || '删除失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function handleViewSubmit() {
|
||||
if (!viewData.value?.id) return
|
||||
await handleSubmit(viewData.value)
|
||||
try {
|
||||
const res = await reimburseApi.getById(viewData.value.id)
|
||||
viewData.value = res.data || res
|
||||
} catch {
|
||||
dialogs.view = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleViewDelete() {
|
||||
if (!viewData.value?.id) return
|
||||
await handleDelete(viewData.value)
|
||||
dialogs.view = false
|
||||
}
|
||||
|
||||
async function openEditDialog(row: any) {
|
||||
try {
|
||||
const res: any = await reimburseApi.getById(row.id)
|
||||
@@ -960,83 +1039,3 @@ function viewDetailSummary({ columns, data }: { columns: any[]; data: any[] }) {
|
||||
return sums
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.detail-table-wrap {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.detail-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.detail-table th {
|
||||
background: var(--mint-table-head, #f8fafc);
|
||||
font-weight: 600;
|
||||
text-align: left;
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid var(--mint-border, #d9e8e2);
|
||||
color: var(--mint-text);
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.detail-table td {
|
||||
padding: 6px;
|
||||
border-bottom: 1px solid var(--mint-border, #d9e8e2);
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.detail-table .col-index {
|
||||
width: 56px;
|
||||
text-align: center;
|
||||
color: var(--mint-text);
|
||||
}
|
||||
|
||||
.detail-table .col-expense {
|
||||
min-width: 180px;
|
||||
}
|
||||
|
||||
.detail-table .col-amount {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.detail-table .col-remark {
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.th-required {
|
||||
color: var(--el-color-danger);
|
||||
margin-left: 2px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.detail-table .col-action {
|
||||
width: 72px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.detail-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 8px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.detail-total {
|
||||
font-size: 14px;
|
||||
color: var(--mint-text, #1e293b);
|
||||
}
|
||||
|
||||
.detail-total b {
|
||||
color: var(--danger, #dc2626);
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.view-detail-table :deep(.el-table__footer-wrapper) {
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
@@ -14,8 +14,11 @@
|
||||
<h2 class="title-bar-heading">报销审批</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-tabs">
|
||||
<el-tabs v-model="activeTab" @tab-change="handleTabChange">
|
||||
<el-tabs
|
||||
v-model="activeTab"
|
||||
class="panel-pill-tabs panel-pill-tabs--lg"
|
||||
@tab-change="handleTabChange"
|
||||
>
|
||||
<!-- 待我审批 -->
|
||||
<el-tab-pane label="待我审批" name="pending">
|
||||
<div class="filter-block">
|
||||
@@ -119,6 +122,8 @@
|
||||
<el-button class="btn-ghost" @click="handleBatchReject">
|
||||
<el-icon><Close /></el-icon>驳回
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="pendingLoading" @refresh="refreshPending" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -133,6 +138,7 @@
|
||||
:summary-method="pendingSummaryMethod"
|
||||
:max-height="'min(520px, calc(100vh - 300px))'"
|
||||
@selection-change="onSelectionChange"
|
||||
@row-dblclick="openView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
@@ -151,7 +157,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="title"
|
||||
@@ -190,21 +200,6 @@
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="280" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px; flex-wrap: nowrap">
|
||||
<el-button class="btn-op-item" @click="openView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="openApproveDialog([row], 'approve')">
|
||||
<el-icon><Check /></el-icon>通过
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="openApproveDialog([row], 'reject')">
|
||||
<el-icon><Close /></el-icon>驳回
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -324,6 +319,7 @@
|
||||
show-summary
|
||||
:summary-method="approvedSummaryMethod"
|
||||
:max-height="'min(520px, calc(100vh - 300px))'"
|
||||
@row-dblclick="openView"
|
||||
>
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
@@ -341,7 +337,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openView(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="title"
|
||||
@@ -387,13 +387,6 @@
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="120" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item" @click="openView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -411,7 +404,6 @@
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 详情 -->
|
||||
@@ -436,6 +428,14 @@
|
||||
<p class="dlg-view-meta">
|
||||
金额(元):<b class="money-em">{{ formatMoneyYuan(viewData.amount || 0) }}</b>
|
||||
</p>
|
||||
<div v-if="activeTab === 'pending'" class="dlg-view-hero-actions">
|
||||
<el-button class="btn-main" type="primary" @click="openApproveDialog([viewData], 'approve')">
|
||||
<el-icon><Check /></el-icon>通过
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="openApproveDialog([viewData], 'reject')">
|
||||
<el-icon><Close /></el-icon>驳回
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dlg-view-section">
|
||||
@@ -537,6 +537,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, computed, onMounted } from 'vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
View,
|
||||
@@ -855,9 +856,3 @@ function viewDetailSummary({ columns, data }: { columns: any[]; data: any[] }) {
|
||||
return sums
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.view-detail-table :deep(.el-table__footer-wrapper) {
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
@@ -91,6 +91,20 @@
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="loadData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<div class="table-scroll table-page-summary">
|
||||
<el-table
|
||||
@@ -104,6 +118,7 @@
|
||||
>
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('applyTime')"
|
||||
prop="applyTime"
|
||||
label="申请时间"
|
||||
min-width="160"
|
||||
@@ -118,16 +133,35 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column prop="bizType" label="业务类型" min-width="100" align="center" header-align="center">
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openViewDetail(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('bizType')"
|
||||
prop="bizType"
|
||||
label="业务类型"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="bizTypeTagType(row.bizType)" size="small">
|
||||
{{ row.bizType }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('applicantName')"
|
||||
prop="applicantName"
|
||||
label="申请人"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('title')"
|
||||
prop="title"
|
||||
label="申请标题"
|
||||
min-width="180"
|
||||
@@ -136,6 +170,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('amount')"
|
||||
prop="amount"
|
||||
label="申请金额(元)"
|
||||
:formatter="moneyTableFormatter"
|
||||
@@ -144,14 +179,28 @@
|
||||
align="right"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column prop="status" label="状态" min-width="110" align="center" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('status')"
|
||||
prop="status"
|
||||
label="状态"
|
||||
min-width="110"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="statusTagType(row.status)" size="small">
|
||||
{{ statusLabel(row.status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="currentNode" label="当前节点" min-width="120" align="center" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('currentNode')"
|
||||
prop="currentNode"
|
||||
label="当前节点"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
v-if="shouldShowWorkflowNodeTag(row.currentNode, row.status)"
|
||||
@@ -163,13 +212,6 @@
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="120" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item" @click="openViewDetail(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -241,9 +283,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { View, Close, Search, RefreshLeft, ArrowUpBold, ArrowDownBold } from '@element-plus/icons-vue'
|
||||
import { Close, Search, RefreshLeft, ArrowUpBold, ArrowDownBold } from '@element-plus/icons-vue'
|
||||
import { advanceApi, reimburseApi } from '@/api/bx'
|
||||
import {
|
||||
bizTypeTagType,
|
||||
@@ -276,6 +320,24 @@ const dialogs = reactive<Record<DialogKey, boolean>>({
|
||||
const mergedRows = ref<any[]>([])
|
||||
const { applicantOptions, loadApplicantOptions } = useApplicantOptions()
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'applyTime', label: '申请时间' },
|
||||
{ prop: 'bizType', label: '业务类型' },
|
||||
{ prop: 'applicantName', label: '申请人' },
|
||||
{ prop: 'title', label: '申请标题' },
|
||||
{ prop: 'amount', label: '申请金额(元)' },
|
||||
{ prop: 'status', label: '状态' },
|
||||
{ prop: 'currentNode', label: '当前节点', defaultVisible: false }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('bx-view-all-list-columns', listColumnDefs)
|
||||
|
||||
const filterForm = reactive({
|
||||
code: '',
|
||||
bizType: '' as string,
|
||||
@@ -333,7 +395,7 @@ function filterMergedRows(rows: any[]) {
|
||||
|
||||
const filteredMergedRows = computed(() => filterMergedRows(mergedRows.value))
|
||||
|
||||
const pager = usePagedTable(() => filteredMergedRows.value, { initialPageSize: 10 })
|
||||
const pager = usePagedTable(() => filteredMergedRows.value, { initialPageSize: 20 })
|
||||
const currentRow = ref<any>(null)
|
||||
|
||||
const viewDetailKvFields = computed<ViewField[]>(() => {
|
||||
@@ -446,9 +508,18 @@ function handleReset() {
|
||||
pager.currentPage.value = 1
|
||||
}
|
||||
|
||||
function summaryMethod(params: { data: Array<{ amount?: number }> }) {
|
||||
function summaryMethod(params: { columns: { property?: string; type?: string }[]; data: Array<{ amount?: number }> }) {
|
||||
const totalAmount = params.data.reduce((sum, row) => sum + Number(row.amount || 0), 0)
|
||||
return ['', `本页合计(${params.data.length}单)`, '', '', '', '', formatSumMoney(totalAmount), '', '', '']
|
||||
let labelPlaced = false
|
||||
return params.columns.map((col) => {
|
||||
if (col.type === 'index') return ''
|
||||
if (!labelPlaced) {
|
||||
labelPlaced = true
|
||||
return `本页合计(${params.data.length}单)`
|
||||
}
|
||||
if (col.property === 'amount') return formatSumMoney(totalAmount)
|
||||
return ''
|
||||
})
|
||||
}
|
||||
|
||||
async function openViewDetail(row: any) {
|
||||
|
||||
@@ -83,6 +83,20 @@
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<ListToolbarEndActions
|
||||
:loading="tableLoading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="loadData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<div class="table-scroll">
|
||||
<el-table
|
||||
@@ -94,6 +108,7 @@
|
||||
>
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('applyTime')"
|
||||
prop="applyTime"
|
||||
label="申请时间"
|
||||
min-width="160"
|
||||
@@ -108,8 +123,19 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column prop="bizType" label="业务类型" min-width="100" align="center" header-align="center">
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openViewDetail(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('bizType')"
|
||||
prop="bizType"
|
||||
label="业务类型"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="bizTypeTagType(row.bizType)" size="small">
|
||||
{{ row.bizType }}
|
||||
@@ -117,6 +143,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('title')"
|
||||
prop="title"
|
||||
label="申请标题"
|
||||
min-width="180"
|
||||
@@ -125,6 +152,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('amount')"
|
||||
prop="amount"
|
||||
label="申请金额(元)"
|
||||
:formatter="moneyTableFormatter"
|
||||
@@ -133,14 +161,28 @@
|
||||
align="right"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column prop="status" label="状态" min-width="110" align="center" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('status')"
|
||||
prop="status"
|
||||
label="状态"
|
||||
min-width="110"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="statusTagType(row.status)" size="small">
|
||||
{{ statusLabel(row.status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="currentNode" label="当前节点" min-width="120" align="center" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('currentNode')"
|
||||
prop="currentNode"
|
||||
label="当前节点"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
v-if="shouldShowWorkflowNodeTag(row.currentNode, row.status)"
|
||||
@@ -152,13 +194,6 @@
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="120" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item" @click="openViewDetail(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -229,9 +264,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { computed, onActivated, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { View, Close, Search, RefreshLeft, ArrowUpBold, ArrowDownBold } from '@element-plus/icons-vue'
|
||||
import { Close, Search, RefreshLeft, ArrowUpBold, ArrowDownBold } from '@element-plus/icons-vue'
|
||||
import { advanceApi, reimburseApi } from '@/api/bx'
|
||||
import {
|
||||
bizTypeTagType,
|
||||
@@ -262,6 +299,23 @@ const dialogs = reactive<Record<DialogKey, boolean>>({
|
||||
|
||||
const mergedRows = ref<any[]>([])
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'applyTime', label: '申请时间' },
|
||||
{ prop: 'bizType', label: '业务类型' },
|
||||
{ prop: 'title', label: '申请标题' },
|
||||
{ prop: 'amount', label: '申请金额(元)' },
|
||||
{ prop: 'status', label: '状态' },
|
||||
{ prop: 'currentNode', label: '当前节点', defaultVisible: false }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('bx-view-mine-list-columns', listColumnDefs)
|
||||
|
||||
const filterForm = reactive({
|
||||
code: '',
|
||||
bizType: '' as string,
|
||||
@@ -310,7 +364,7 @@ const {
|
||||
pageSize,
|
||||
rangeText,
|
||||
onSizeChange
|
||||
} = usePagedTable(() => filteredMergedRows.value, { initialPageSize: 10 })
|
||||
} = usePagedTable(() => filteredMergedRows.value, { initialPageSize: 20 })
|
||||
const currentRow = ref<any>(null)
|
||||
|
||||
const viewDetailKvFields = computed<ViewField[]>(() => {
|
||||
|
||||
@@ -93,6 +93,8 @@
|
||||
<el-button class="btn-ghost" :loading="loadingMap.batchReject" @click="handleBatchReject">
|
||||
<el-icon><Close /></el-icon>批量驳回
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="tableLoading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -107,6 +109,7 @@
|
||||
:summary-method="summaryMethod"
|
||||
:max-height="'min(520px, calc(100vh - 300px))'"
|
||||
@selection-change="onSelectionChange"
|
||||
@row-dblclick="openViewDetailFromRow"
|
||||
>
|
||||
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
@@ -125,7 +128,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openViewDetail(row)">{{ row.applyCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="bizType" label="业务类型" min-width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="bizTypeTagType(row.bizType)" size="small">
|
||||
@@ -163,25 +170,6 @@
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="280" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px; flex-wrap: nowrap">
|
||||
<el-button class="btn-op-item" @click="openViewDetail(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item"
|
||||
:loading="loadingMap[`pass_${row.id}`]"
|
||||
@click="handleApprove(row)"
|
||||
>
|
||||
<el-icon><Check /></el-icon>通过
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="openRejectDialog(row)">
|
||||
<el-icon><Close /></el-icon>驳回
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -228,6 +216,19 @@
|
||||
金额(元):<b class="money-em">{{ formatMoneyYuan(currentRow?.amount || 0) }}</b>
|
||||
· 申请人:{{ currentRow?.applicantName || '-' }}
|
||||
</p>
|
||||
<div v-if="currentRow" class="dlg-view-hero-actions">
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:loading="loadingMap[`pass_${currentRow.id}`]"
|
||||
@click="handleApprove(currentRow)"
|
||||
>
|
||||
<el-icon><Check /></el-icon>通过
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="openRejectDialog(currentRow)">
|
||||
<el-icon><Close /></el-icon>驳回
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dlg-view-section">
|
||||
<h4 class="dlg-view-section-title">基础信息</h4>
|
||||
@@ -284,10 +285,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { computed, onActivated, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import {
|
||||
View,
|
||||
Check,
|
||||
Close,
|
||||
Search,
|
||||
@@ -376,7 +377,7 @@ const {
|
||||
pageSize,
|
||||
rangeText,
|
||||
onSizeChange
|
||||
} = usePagedTable(() => filteredMergedRows.value, { initialPageSize: 10 })
|
||||
} = usePagedTable(() => filteredMergedRows.value, { initialPageSize: 20 })
|
||||
const currentRow = ref<any>(null)
|
||||
|
||||
const viewDetailKvFields = computed<ViewField[]>(() => {
|
||||
@@ -602,6 +603,10 @@ function summaryMethod(params: { data: Array<{ amount?: number }> }) {
|
||||
return ['', '', `本页合计(${params.data.length}单)`, '', '', '', '', formatSumMoney(totalAmount), '', '']
|
||||
}
|
||||
|
||||
function openViewDetailFromRow(row: any) {
|
||||
openViewDetail(row)
|
||||
}
|
||||
|
||||
async function openViewDetail(row: any) {
|
||||
currentRow.value = row
|
||||
viewFlowNodes.value = []
|
||||
|
||||
@@ -20,19 +20,51 @@
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">0</span> 项
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button class="btn-main" type="primary" @click="openAddDialog">
|
||||
<el-icon><Plus /></el-icon>新增节点
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
:loading="loadingMap.rowDelete"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :disabled="selectedRows.length !== 1" @click="handleToolbarMoveUp">
|
||||
<el-icon><ArrowUp /></el-icon>上移
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :disabled="selectedRows.length !== 1" @click="handleToolbarMoveDown">
|
||||
<el-icon><ArrowDown /></el-icon>下移
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loadingMap.save" @click="saveNodes">
|
||||
<el-icon><Upload /></el-icon>保存配置
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadWfDef" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="nodes" v-loading="loading" stripe>
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="nodes"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
@selection-change="onSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="nodeName"
|
||||
@@ -58,30 +90,6 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="360" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px; flex-wrap: nowrap">
|
||||
<el-button class="btn-op-item" @click="openEditDialog(row)">
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item"
|
||||
:disabled="!canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
:loading="loadingMap.rowDelete"
|
||||
@click="deleteNode(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="moveUp(row)">
|
||||
<el-icon><ArrowUp /></el-icon>上移
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="moveDown(row)">
|
||||
<el-icon><ArrowDown /></el-icon>下移
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</section>
|
||||
@@ -186,6 +194,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, computed, onMounted } from 'vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
@@ -212,6 +221,7 @@ const dialogs = reactive<Record<DialogKey, boolean>>({
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
const wfDef = ref<Record<string, any>>({})
|
||||
const nodes = computed(() => wfDef.value.nodes || [])
|
||||
const userOptions = ref<
|
||||
@@ -269,6 +279,36 @@ onMounted(() => {
|
||||
loadUsers()
|
||||
})
|
||||
|
||||
function onSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条节点')
|
||||
return
|
||||
}
|
||||
openEditDialog(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条节点')
|
||||
return
|
||||
}
|
||||
deleteNode(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarMoveUp() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
moveUp(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarMoveDown() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
moveDown(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function buildNodePayload(list: Record<string, any>[]) {
|
||||
return list.map((n, i) => ({
|
||||
nodeName: n.nodeName,
|
||||
|
||||
@@ -20,19 +20,51 @@
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">0</span> 项
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button class="btn-main" type="primary" @click="openAddDialog">
|
||||
<el-icon><Plus /></el-icon>新增节点
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
:loading="loadingMap.rowDelete"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :disabled="selectedRows.length !== 1" @click="handleToolbarMoveUp">
|
||||
<el-icon><ArrowUp /></el-icon>上移
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :disabled="selectedRows.length !== 1" @click="handleToolbarMoveDown">
|
||||
<el-icon><ArrowDown /></el-icon>下移
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loadingMap.save" @click="saveNodes">
|
||||
<el-icon><Upload /></el-icon>保存配置
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadWfDef" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="nodes" v-loading="loading" stripe>
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="nodes"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
@selection-change="onSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" min-width="48" align="center" header-align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="nodeName"
|
||||
@@ -58,30 +90,6 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="360" fixed="right" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px; flex-wrap: nowrap">
|
||||
<el-button class="btn-op-item" @click="openEditDialog(row)">
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item"
|
||||
:disabled="!canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
:loading="loadingMap.rowDelete"
|
||||
@click="deleteNode(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="moveUp(row)">
|
||||
<el-icon><ArrowUp /></el-icon>上移
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="moveDown(row)">
|
||||
<el-icon><ArrowDown /></el-icon>下移
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</section>
|
||||
@@ -186,6 +194,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, computed, onMounted } from 'vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
@@ -212,6 +221,7 @@ const dialogs = reactive<Record<DialogKey, boolean>>({
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const selectedRows = ref<Record<string, any>[]>([])
|
||||
const wfDef = ref<Record<string, any>>({})
|
||||
const nodes = computed(() => wfDef.value.nodes || [])
|
||||
const userOptions = ref<
|
||||
@@ -269,6 +279,36 @@ onMounted(() => {
|
||||
loadUsers()
|
||||
})
|
||||
|
||||
function onSelectionChange(rows: Record<string, any>[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条节点')
|
||||
return
|
||||
}
|
||||
openEditDialog(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条节点')
|
||||
return
|
||||
}
|
||||
deleteNode(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarMoveUp() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
moveUp(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarMoveDown() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
moveDown(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function buildNodePayload(list: Record<string, any>[]) {
|
||||
return list.map((n, i) => ({
|
||||
nodeName: n.nodeName,
|
||||
|
||||
@@ -172,7 +172,7 @@
|
||||
const followQuery = ref<ClueFollowQuery>({
|
||||
clueId: '',
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
pageSize: 20
|
||||
})
|
||||
|
||||
const clueFormRef = ref<InstanceType<typeof ClueForm>>()
|
||||
|
||||
@@ -3,18 +3,20 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>线索管理</h2>
|
||||
<h2 class="title-bar-heading">线索管理</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-tabs">
|
||||
<el-tabs v-model="activeView" @tab-change="handleViewChange">
|
||||
<el-tab-pane label="我的线索" name="mine" />
|
||||
<el-tab-pane label="全部线索" name="all" />
|
||||
<el-tab-pane label="待跟进" name="toFollow" />
|
||||
<el-tab-pane label="今日新增" name="today" />
|
||||
<el-tab-pane label="已转化" name="converted" />
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-tabs
|
||||
v-model="activeView"
|
||||
class="panel-pill-tabs panel-pill-tabs--lg"
|
||||
@tab-change="handleViewChange"
|
||||
>
|
||||
<el-tab-pane label="我的线索" name="mine" />
|
||||
<el-tab-pane label="全部线索" name="all" />
|
||||
<el-tab-pane label="待跟进" name="toFollow" />
|
||||
<el-tab-pane label="今日新增" name="today" />
|
||||
<el-tab-pane label="已转化" name="converted" />
|
||||
</el-tabs>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form :model="searchForm" class="filter-form" @submit.prevent>
|
||||
@@ -157,6 +159,40 @@
|
||||
<el-button v-if="hasCluePerm('add')" class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增线索
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasCluePerm('edit')"
|
||||
class="btn-ghost"
|
||||
:disabled="single || selectedRows[0]?.isConverted === 1"
|
||||
@click="handleEdit()"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasCluePerm('follow')"
|
||||
class="btn-ghost"
|
||||
:disabled="
|
||||
single ||
|
||||
selectedRows[0]?.isConverted === 1 ||
|
||||
selectedRows[0]?.status === 'invalid'
|
||||
"
|
||||
@click="handleAddFollow()"
|
||||
>
|
||||
<el-icon><ChatLineRound /></el-icon>跟进
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasCluePerm('remove')"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="
|
||||
multiple ||
|
||||
selectedRows[0]?.isConverted === 1 ||
|
||||
!allRowsDeletableByCreator(selectedRows)
|
||||
"
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete()"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasCluePerm('assign')"
|
||||
class="btn-ghost"
|
||||
@@ -181,6 +217,16 @@
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>标为无效
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="getList"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -367,54 +413,6 @@
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="400"
|
||||
align="center"
|
||||
header-align="center"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button v-if="hasCluePerm('query')" class="btn-op-item" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasCluePerm('edit')"
|
||||
class="btn-op-item primary"
|
||||
:disabled="row.isConverted === 1"
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasCluePerm('follow')"
|
||||
class="btn-op-item primary"
|
||||
:disabled="row.isConverted === 1 || row.status === 'invalid'"
|
||||
@click="handleAddFollow(row)"
|
||||
>
|
||||
<el-icon><ChatLineRound /></el-icon>跟进
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasCluePerm('invalid')"
|
||||
class="btn-op-item op-warn"
|
||||
:disabled="row.isConverted === 1 || row.status === 'invalid'"
|
||||
@click="handleInvalid(row)"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>无效
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasCluePerm('remove')"
|
||||
class="btn-op-item danger"
|
||||
:disabled="row.isConverted === 1 || !canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -438,45 +436,6 @@
|
||||
<InvalidForm ref="invalidFormRef" @success="getList" />
|
||||
<DetailDrawer ref="detailDrawerRef" @success="getList" />
|
||||
|
||||
<el-dialog
|
||||
v-model="columnSettingDialog.visible"
|
||||
title="列设置"
|
||||
width="600px"
|
||||
class="dialog-form-layout"
|
||||
align-center
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div class="column-setting-content">
|
||||
<el-checkbox
|
||||
v-model="checkAll"
|
||||
:indeterminate="isIndeterminate"
|
||||
@change="handleCheckAllChange"
|
||||
>
|
||||
全选
|
||||
</el-checkbox>
|
||||
<el-divider />
|
||||
<el-checkbox-group v-model="visibleColumns" @change="handleCheckedColumnsChange">
|
||||
<div v-for="col in tableColumns" :key="col.prop" class="column-item">
|
||||
<el-checkbox :label="col.prop" :disabled="col.fixed">{{ col.label }}</el-checkbox>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button class="btn-ghost" @click="columnSettingDialog.visible = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleResetColumns">
|
||||
<el-icon><RefreshLeft /></el-icon>恢复默认
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" @click="handleSaveColumnSetting">
|
||||
<el-icon><Check /></el-icon>保存
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 导入弹窗 -->
|
||||
<el-dialog
|
||||
v-model="importDialogVisible"
|
||||
@@ -536,7 +495,6 @@
|
||||
Check,
|
||||
Search,
|
||||
RefreshLeft,
|
||||
View,
|
||||
User,
|
||||
ArrowUpBold,
|
||||
ArrowDownBold,
|
||||
@@ -550,7 +508,7 @@
|
||||
import type { UploadFile } from 'element-plus'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useCluePerm } from '@/hooks/business/useCluePerm'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import {
|
||||
listClue,
|
||||
listMyClue,
|
||||
@@ -567,6 +525,8 @@
|
||||
import AssignForm from './assignForm.vue'
|
||||
import InvalidForm from './invalidForm.vue'
|
||||
import DetailDrawer from './detailDrawer.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const { loadPerms, hasCluePerm } = useCluePerm()
|
||||
@@ -589,7 +549,7 @@
|
||||
const clueList = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const selectedRows = ref<any[]>([])
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
@@ -602,38 +562,44 @@
|
||||
const invalidFormRef = ref<InstanceType<typeof InvalidForm>>()
|
||||
const detailDrawerRef = ref<InstanceType<typeof DetailDrawer>>()
|
||||
|
||||
const COLUMN_STORAGE_KEY = 'crm_clue_visible_columns'
|
||||
const tableColumns = ref([
|
||||
{ prop: 'company', label: '公司名称', fixed: false },
|
||||
{ prop: 'customerType', label: '客户类型', fixed: false },
|
||||
{ prop: 'mobile', label: '手机号', fixed: false },
|
||||
{ prop: 'source', label: '线索来源', fixed: false },
|
||||
{ prop: 'level', label: '线索等级', fixed: false },
|
||||
{ prop: 'status', label: '线索状态', fixed: false },
|
||||
{ prop: 'industry', label: '所属行业', fixed: false },
|
||||
{ prop: 'parkArea', label: '所在园区', fixed: false },
|
||||
{ prop: 'ownerUserName', label: '负责人', fixed: false },
|
||||
{ prop: 'followCount', label: '跟进次数', fixed: false },
|
||||
{ prop: 'lastTime', label: '最后跟进时间', fixed: false },
|
||||
{ prop: 'nextTime', label: '下次联系时间', fixed: false },
|
||||
{ prop: 'createTime', label: '创建时间', fixed: false }
|
||||
])
|
||||
const defaultVisibleColumns = [
|
||||
'company',
|
||||
'customerType',
|
||||
'mobile',
|
||||
'source',
|
||||
'level',
|
||||
'status',
|
||||
'parkArea',
|
||||
'ownerUserName',
|
||||
'followCount',
|
||||
'lastTime',
|
||||
'nextTime',
|
||||
'createTime'
|
||||
const listColumnDefs = [
|
||||
{ prop: 'company', label: '公司名称' },
|
||||
{ prop: 'customerType', label: '客户类型' },
|
||||
{ prop: 'mobile', label: '手机号' },
|
||||
{ prop: 'source', label: '线索来源' },
|
||||
{ prop: 'level', label: '线索等级' },
|
||||
{ prop: 'status', label: '线索状态' },
|
||||
{ prop: 'industry', label: '所属行业' },
|
||||
{ prop: 'parkArea', label: '所在园区' },
|
||||
{ prop: 'ownerUserName', label: '负责人' },
|
||||
{ prop: 'followCount', label: '跟进次数' },
|
||||
{ prop: 'lastTime', label: '最后跟进时间' },
|
||||
{ prop: 'nextTime', label: '下次联系时间' },
|
||||
{ prop: 'createTime', label: '创建时间' }
|
||||
]
|
||||
const visibleColumns = ref<string[]>([])
|
||||
const columnSettingDialog = reactive({ visible: false })
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('crm_clue_visible_columns', listColumnDefs, {
|
||||
defaultVisibleProps: [
|
||||
'company',
|
||||
'customerType',
|
||||
'mobile',
|
||||
'source',
|
||||
'level',
|
||||
'status',
|
||||
'parkArea',
|
||||
'ownerUserName',
|
||||
'followCount',
|
||||
'lastTime',
|
||||
'nextTime',
|
||||
'createTime'
|
||||
]
|
||||
})
|
||||
|
||||
const importDialogVisible = ref(false)
|
||||
const importFileList = ref<UploadFile[]>([])
|
||||
@@ -641,8 +607,6 @@
|
||||
const importUpdateSupport = ref(false)
|
||||
const templateLoading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const checkAll = ref(false)
|
||||
const isIndeterminate = ref(false)
|
||||
|
||||
const canConvertSelected = computed(() => {
|
||||
if (selectedRows.value.length !== 1) return false
|
||||
@@ -747,8 +711,13 @@
|
||||
clueFormRef.value?.open()
|
||||
}
|
||||
|
||||
function handleEdit(row: any) {
|
||||
clueFormRef.value?.open(row.id)
|
||||
function handleEdit(row?: any) {
|
||||
if (!row && ids.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条数据进行编辑')
|
||||
return
|
||||
}
|
||||
const id = row?.id || ids.value[0]
|
||||
clueFormRef.value?.open(id)
|
||||
}
|
||||
|
||||
function handleView(row?: any) {
|
||||
@@ -857,55 +826,6 @@
|
||||
await getList()
|
||||
}
|
||||
|
||||
function initColumnSetting() {
|
||||
const saved = localStorage.getItem(COLUMN_STORAGE_KEY)
|
||||
if (saved) {
|
||||
try {
|
||||
visibleColumns.value = JSON.parse(saved)
|
||||
} catch {
|
||||
visibleColumns.value = [...defaultVisibleColumns]
|
||||
}
|
||||
} else {
|
||||
visibleColumns.value = [...defaultVisibleColumns]
|
||||
}
|
||||
updateCheckAllStatus()
|
||||
}
|
||||
|
||||
function isColumnVisible(prop: string) {
|
||||
return visibleColumns.value.includes(prop)
|
||||
}
|
||||
|
||||
function handleColumnSetting() {
|
||||
columnSettingDialog.visible = true
|
||||
}
|
||||
|
||||
function handleCheckAllChange(val: boolean) {
|
||||
visibleColumns.value = val ? tableColumns.value.map((col) => col.prop) : []
|
||||
isIndeterminate.value = false
|
||||
}
|
||||
|
||||
function handleCheckedColumnsChange() {
|
||||
updateCheckAllStatus()
|
||||
}
|
||||
|
||||
function updateCheckAllStatus() {
|
||||
const checkedCount = visibleColumns.value.length
|
||||
const totalCount = tableColumns.value.length
|
||||
checkAll.value = checkedCount === totalCount
|
||||
isIndeterminate.value = checkedCount > 0 && checkedCount < totalCount
|
||||
}
|
||||
|
||||
function handleResetColumns() {
|
||||
visibleColumns.value = [...defaultVisibleColumns]
|
||||
updateCheckAllStatus()
|
||||
}
|
||||
|
||||
function handleSaveColumnSetting() {
|
||||
localStorage.setItem(COLUMN_STORAGE_KEY, JSON.stringify(visibleColumns.value))
|
||||
ElMessage.success('列设置保存成功')
|
||||
columnSettingDialog.visible = false
|
||||
}
|
||||
|
||||
function handleImport() {
|
||||
importFileList.value = []
|
||||
importUpdateSupport.value = false
|
||||
@@ -991,7 +911,6 @@
|
||||
|
||||
onMounted(() => {
|
||||
loadPerms()
|
||||
initColumnSetting()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
@@ -1005,13 +924,4 @@
|
||||
.quick-search-icon {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.column-setting-content {
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.column-item {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>线索统计</h2>
|
||||
<h2 class="title-bar-heading">线索统计</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
|
||||
@@ -1,35 +1,46 @@
|
||||
<!-- 合同审批记录 -->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 查询表单 -->
|
||||
<el-card shadow="hover" v-show="showSearch" class="mb-[10px]">
|
||||
<el-form :model="queryParams" ref="queryFormRef" label-width="90px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">合同审批记录</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form ref="queryFormRef" :model="queryParams" class="filter-form" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
<el-form-item label="合同编号" prop="contractNo">
|
||||
<el-input v-model="queryParams.contractNo" placeholder="请输入合同编号" clearable @keyup.enter="handleQuery" />
|
||||
<el-input
|
||||
v-model="queryParams.contractNo"
|
||||
placeholder="合同编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<el-form-item label="合同名称" prop="contractName">
|
||||
<el-input v-model="queryParams.contractName" placeholder="请输入合同名称" clearable @keyup.enter="handleQuery" />
|
||||
<el-input
|
||||
v-model="queryParams.contractName"
|
||||
placeholder="合同名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<el-form-item label="审批人" prop="approverName">
|
||||
<el-input v-model="queryParams.approverName" placeholder="请输入审批人" clearable @keyup.enter="handleQuery" />
|
||||
<el-input
|
||||
v-model="queryParams.approverName"
|
||||
placeholder="审批人"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<el-form-item label="审批结果" prop="approvalResult">
|
||||
<el-select v-model="queryParams.approvalResult" placeholder="请选择审批结果" clearable style="width: 100%">
|
||||
<el-select v-model="queryParams.approvalResult" placeholder="全部" clearable>
|
||||
<el-option label="通过" value="approved" />
|
||||
<el-option label="驳回" value="rejected" />
|
||||
<el-option label="待审批" value="pending" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="8" :lg="12" :md="16" :sm="24" :xs="24">
|
||||
<el-form-item label="审批时间">
|
||||
<el-form-item label="审批时间" class="form-col-span-2">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="daterange"
|
||||
@@ -40,113 +51,188 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24" style="text-align: right">
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按合同、审批人、结果及时间筛选。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" :loading="loading" @click="resetQuery">
|
||||
<el-icon><RefreshLeft /></el-icon>重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleQuery">
|
||||
<el-icon><Search /></el-icon>搜索
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col v-if="hasContractPerm('approvalExport')" :span="1.5">
|
||||
<el-button type="success" icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<el-table v-loading="loading" :data="approvalList" border>
|
||||
<el-table-column label="合同编号" align="center" prop="contractNo" width="150" :show-overflow-tooltip="true">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="handleViewContract(scope.row)">{{ scope.row.contractNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合同名称" prop="contractName" :show-overflow-tooltip="true" min-width="200" />
|
||||
<el-table-column label="审批级别" align="center" prop="step" width="100">
|
||||
<template #default="scope"> 第{{ scope.row.step }}级 </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审批人" align="center" prop="approverName" width="120" />
|
||||
<el-table-column label="审批结果" align="center" prop="approvalResult" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.approvalResult === 'approved'" type="success">通过</el-tag>
|
||||
<el-tag v-else-if="scope.row.approvalResult === 'rejected'" type="danger">驳回</el-tag>
|
||||
<el-tag v-else type="warning">待审批</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审批意见" prop="approvalOpinion" :show-overflow-tooltip="true" min-width="200" />
|
||||
<el-table-column label="审批时间" align="center" prop="approvalTime" width="160">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.approvalTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-tooltip v-if="hasContractPerm('approvalQuery')" content="查看" placement="top">
|
||||
<el-button link type="primary" icon="View" @click="handleView(scope.row)" />
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
v-if="hasContractPerm('approvalApprove') && scope.row.approvalResult === 'pending'"
|
||||
content="审批"
|
||||
placement="top"
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<el-button
|
||||
v-if="hasContractPerm('approvalExport')"
|
||||
class="btn-ghost"
|
||||
:loading="exportLoading"
|
||||
@click="handleExport"
|
||||
>
|
||||
<el-button link type="success" icon="CircleCheck" @click="handleApprove(scope.row)" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-icon><Download /></el-icon>导出
|
||||
</el-button>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 查看详情 -->
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewDialog.visible"
|
||||
title="审批详情"
|
||||
:icon="Document"
|
||||
:code="viewDialog.data.contractNo"
|
||||
code-label="合同编号"
|
||||
:meta="viewDialog.data.contractName"
|
||||
:sections="approvalViewSections"
|
||||
append-to-body
|
||||
/>
|
||||
|
||||
<!-- 审批对话框 -->
|
||||
<el-dialog title="审批" v-model="approvalDialog.visible" width="600px" append-to-body>
|
||||
<el-form ref="approvalFormRef" :model="approvalForm" :rules="approvalRules" label-width="100px">
|
||||
<el-form-item label="审批结果" prop="approvalResult">
|
||||
<el-radio-group v-model="approvalForm.approvalResult">
|
||||
<el-radio value="approved">通过</el-radio>
|
||||
<el-radio value="rejected">驳回</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="审批意见" prop="approvalOpinion">
|
||||
<el-input
|
||||
v-model="approvalForm.approvalOpinion"
|
||||
type="textarea"
|
||||
:rows="5"
|
||||
:placeholder="approvalForm.approvalResult === 'rejected' ? '请输入驳回原因' : '请输入审批意见(可选)'"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="approvalDialog.visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitApproval">确 定</el-button>
|
||||
<ListToolbarEndActions :loading="loading" @refresh="getList" />
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
v-loading="loading"
|
||||
:data="approvalList"
|
||||
stripe
|
||||
row-key="id"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column
|
||||
prop="contractNo"
|
||||
label="合同编号"
|
||||
min-width="150"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleViewContract(row)">{{ row.contractNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="contractName"
|
||||
label="合同名称"
|
||||
min-width="200"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="审批级别" min-width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">第{{ row.step }}级</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="approverName"
|
||||
label="审批人"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column label="审批结果" min-width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.approvalResult === 'approved'" type="success" size="small">通过</el-tag>
|
||||
<el-tag v-else-if="row.approvalResult === 'rejected'" type="danger" size="small">驳回</el-tag>
|
||||
<el-tag v-else type="warning" size="small">待审批</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="approvalOpinion"
|
||||
label="审批意见"
|
||||
min-width="200"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="审批时间" min-width="160" align="center" header-align="center">
|
||||
<template #default="{ row }">{{ parseTime(row.approvalTime) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
v-model:current-page="queryParams.pageNum"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
@size-change="getList"
|
||||
@current-change="getList"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewDialog.visible"
|
||||
title="审批详情"
|
||||
:icon="Document"
|
||||
:code="viewDialog.data.contractNo"
|
||||
code-label="合同编号"
|
||||
:meta="viewDialog.data.contractName"
|
||||
:sections="approvalViewSections"
|
||||
append-to-body
|
||||
>
|
||||
<template #hero-actions>
|
||||
<div class="approval-view-hero-actions">
|
||||
<el-button
|
||||
v-if="hasContractPerm('approvalApprove') && viewDialog.data.approvalResult === 'pending'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleApprove(viewDialog.data)"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>审批
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="approvalDialog.visible"
|
||||
title="审批"
|
||||
width="600px"
|
||||
class="dialog-form-layout order-module-dialog-mask"
|
||||
align-center
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
append-to-body
|
||||
>
|
||||
<el-form
|
||||
ref="approvalFormRef"
|
||||
:model="approvalForm"
|
||||
:rules="approvalRules"
|
||||
label-position="top"
|
||||
scroll-to-error
|
||||
>
|
||||
<div class="form-grid-2">
|
||||
<el-form-item label="审批结果" prop="approvalResult" class="form-col-span-2">
|
||||
<el-radio-group v-model="approvalForm.approvalResult">
|
||||
<el-radio value="approved">通过</el-radio>
|
||||
<el-radio value="rejected">驳回</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="审批意见" prop="approvalOpinion" class="form-col-span-2">
|
||||
<el-input
|
||||
v-model="approvalForm.approvalOpinion"
|
||||
type="textarea"
|
||||
:rows="5"
|
||||
:placeholder="
|
||||
approvalForm.approvalResult === 'rejected'
|
||||
? '请输入驳回原因'
|
||||
: '请输入审批意见(可选)'
|
||||
"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button class="btn-ghost" @click="approvalDialog.visible = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" :loading="submitLoading" @click="submitApproval">
|
||||
<el-icon><Check /></el-icon>确定
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ContractApproval">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { Document } from '@element-plus/icons-vue'
|
||||
import { Document, Download, Search, RefreshLeft, Close, Check, EditPen } from '@element-plus/icons-vue'
|
||||
import SystemViewDialog, {
|
||||
type ViewField,
|
||||
type ViewSection
|
||||
@@ -168,54 +254,50 @@ import { useContractPerm } from '@/hooks/business/useContractPerm'
|
||||
const router = useRouter()
|
||||
const { loadPerms, hasContractPerm } = useContractPerm()
|
||||
|
||||
// 查询参数
|
||||
const queryParams = ref<ApprovalQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
contractNo: undefined,
|
||||
contractName: undefined,
|
||||
approverName: undefined,
|
||||
approvalResult: undefined,
|
||||
beginTime: undefined,
|
||||
endTime: undefined
|
||||
});
|
||||
})
|
||||
|
||||
// 审批表单
|
||||
const approvalForm = ref({
|
||||
id: undefined as number | undefined,
|
||||
approvalResult: 'approved',
|
||||
approvalOpinion: ''
|
||||
});
|
||||
})
|
||||
|
||||
// 审批表单校验规则
|
||||
const approvalRules = ref({
|
||||
approvalResult: [{ required: true, message: '请选择审批结果', trigger: 'change' }],
|
||||
approvalOpinion: [
|
||||
{
|
||||
validator: (rule: any, value: any, callback: any) => {
|
||||
validator: (_rule: unknown, value: string, callback: (err?: Error) => void) => {
|
||||
if (approvalForm.value.approvalResult === 'rejected' && !value) {
|
||||
callback(new Error('驳回时必须填写驳回原因'));
|
||||
callback(new Error('驳回时必须填写驳回原因'))
|
||||
} else {
|
||||
callback();
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
// 数据列表
|
||||
const approvalList = ref<ApprovalVO[]>([]);
|
||||
const loading = ref(true);
|
||||
const total = ref(0);
|
||||
const showSearch = ref(false);
|
||||
const dateRange = ref<[string, string]>();
|
||||
const approvalList = ref<ApprovalVO[]>([])
|
||||
const loading = ref(true)
|
||||
const submitLoading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const total = ref(0)
|
||||
const dateRange = ref<[string, string]>()
|
||||
|
||||
// 查看详情对话框
|
||||
const viewDialog = reactive({
|
||||
visible: false,
|
||||
data: {} as ApprovalVO
|
||||
});
|
||||
})
|
||||
|
||||
function approvalResultTag(result?: string) {
|
||||
if (result === 'approved') return { label: '通过', type: 'success' as const }
|
||||
@@ -252,101 +334,93 @@ const approvalViewSections = computed<ViewSection[]>(() => {
|
||||
]
|
||||
})
|
||||
|
||||
// 审批对话框
|
||||
const approvalDialog = reactive({
|
||||
visible: false
|
||||
});
|
||||
})
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const approvalFormRef = ref<ElFormInstance>();
|
||||
const queryFormRef = ref<ElFormInstance>()
|
||||
const approvalFormRef = ref<ElFormInstance>()
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
try {
|
||||
// 处理日期范围
|
||||
if (dateRange.value && dateRange.value.length === 2) {
|
||||
queryParams.value.beginTime = dateRange.value[0];
|
||||
queryParams.value.endTime = dateRange.value[1];
|
||||
queryParams.value.beginTime = dateRange.value[0]
|
||||
queryParams.value.endTime = dateRange.value[1]
|
||||
} else {
|
||||
queryParams.value.beginTime = undefined;
|
||||
queryParams.value.endTime = undefined;
|
||||
queryParams.value.beginTime = undefined
|
||||
queryParams.value.endTime = undefined
|
||||
}
|
||||
|
||||
const res = await listApproval(queryParams.value);
|
||||
approvalList.value = res.rows;
|
||||
total.value = res.total;
|
||||
const res = await listApproval(queryParams.value)
|
||||
approvalList.value = res.rows
|
||||
total.value = res.total
|
||||
} finally {
|
||||
loading.value = false;
|
||||
loading.value = false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
dateRange.value = undefined;
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
dateRange.value = undefined
|
||||
queryFormRef.value?.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 查看详情 */
|
||||
const handleView = async (row: ApprovalVO) => {
|
||||
const res = await getApproval(row.id);
|
||||
viewDialog.data = res.data;
|
||||
viewDialog.visible = true;
|
||||
};
|
||||
const res = await getApproval(row.id)
|
||||
viewDialog.data = res.data
|
||||
viewDialog.visible = true
|
||||
}
|
||||
|
||||
/** 查看合同 */
|
||||
const handleViewContract = (row: ApprovalVO) => {
|
||||
router.push({
|
||||
path: '/crm/contract/detail',
|
||||
query: { id: row.contractId }
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
/** 审批操作 */
|
||||
const handleApprove = (row: ApprovalVO) => {
|
||||
approvalForm.value = {
|
||||
id: row.id,
|
||||
approvalResult: 'approved',
|
||||
approvalOpinion: ''
|
||||
};
|
||||
approvalDialog.visible = true;
|
||||
};
|
||||
}
|
||||
approvalDialog.visible = true
|
||||
}
|
||||
|
||||
/** 提交审批 */
|
||||
const submitApproval = () => {
|
||||
approvalFormRef.value?.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
if (approvalForm.value.approvalResult === 'approved') {
|
||||
await approvePass({
|
||||
id: approvalForm.value.id!,
|
||||
approvalOpinion: approvalForm.value.approvalOpinion
|
||||
});
|
||||
$modal.msgSuccess('审批通过')
|
||||
} else {
|
||||
await approveReject({
|
||||
id: approvalForm.value.id!,
|
||||
approvalOpinion: approvalForm.value.approvalOpinion
|
||||
})
|
||||
$modal.msgSuccess('已驳回')
|
||||
}
|
||||
approvalDialog.visible = false;
|
||||
await getList();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
if (!valid) return
|
||||
submitLoading.value = true
|
||||
try {
|
||||
if (approvalForm.value.approvalResult === 'approved') {
|
||||
await approvePass({
|
||||
id: approvalForm.value.id!,
|
||||
approvalOpinion: approvalForm.value.approvalOpinion
|
||||
})
|
||||
$modal.msgSuccess('审批通过')
|
||||
} else {
|
||||
await approveReject({
|
||||
id: approvalForm.value.id!,
|
||||
approvalOpinion: approvalForm.value.approvalOpinion
|
||||
})
|
||||
$modal.msgSuccess('已驳回')
|
||||
}
|
||||
approvalDialog.visible = false
|
||||
await getList()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
submitLoading.value = false
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
if (dateRange.value && dateRange.value.length === 2) {
|
||||
queryParams.value.beginTime = dateRange.value[0]
|
||||
@@ -355,6 +429,7 @@ const handleExport = async () => {
|
||||
queryParams.value.beginTime = undefined
|
||||
queryParams.value.endTime = undefined
|
||||
}
|
||||
exportLoading.value = true
|
||||
try {
|
||||
const res = await exportApproval(queryParams.value)
|
||||
const blob =
|
||||
@@ -372,6 +447,8 @@ const handleExport = async () => {
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
$modal.msgError('导出失败')
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,10 +457,3 @@ onMounted(async () => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.text-content {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
@@ -1,22 +1,32 @@
|
||||
<!-- 合同变更记录 -->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 查询表单 -->
|
||||
<el-card shadow="hover" v-show="showSearch" class="mb-[10px]">
|
||||
<el-form :model="queryParams" ref="queryFormRef" label-width="90px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">合同变更</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form ref="queryFormRef" :model="queryParams" class="filter-form" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
<el-form-item label="合同编号" prop="contractNo">
|
||||
<el-input v-model="queryParams.contractNo" placeholder="请输入合同编号" clearable @keyup.enter="handleQuery" />
|
||||
<el-input
|
||||
v-model="queryParams.contractNo"
|
||||
placeholder="合同编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<el-form-item label="合同名称" prop="contractName">
|
||||
<el-input v-model="queryParams.contractName" placeholder="请输入合同名称" clearable @keyup.enter="handleQuery" />
|
||||
<el-input
|
||||
v-model="queryParams.contractName"
|
||||
placeholder="合同名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<el-form-item label="变更类型" prop="changeType">
|
||||
<el-select v-model="queryParams.changeType" placeholder="请选择变更类型" clearable style="width: 100%">
|
||||
<el-select v-model="queryParams.changeType" placeholder="全部" clearable>
|
||||
<el-option
|
||||
v-for="dict in dictStore.getOptions('crm_contract_change_type')"
|
||||
:key="dict.value"
|
||||
@@ -25,18 +35,14 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<el-form-item label="审批状态" prop="approvalStatus">
|
||||
<el-select v-model="queryParams.approvalStatus" placeholder="请选择审批状态" clearable style="width: 100%">
|
||||
<el-select v-model="queryParams.approvalStatus" placeholder="全部" clearable>
|
||||
<el-option label="待审批" value="pending" />
|
||||
<el-option label="已通过" value="approved" />
|
||||
<el-option label="已驳回" value="rejected" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="8" :lg="12" :md="16" :sm="24" :xs="24">
|
||||
<el-form-item label="变更时间">
|
||||
<el-form-item label="变更时间" class="form-col-span-2">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="daterange"
|
||||
@@ -47,173 +53,308 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24" style="text-align: right">
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按合同、变更类型、审批状态及时间筛选。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" :loading="loading" @click="resetQuery">
|
||||
<el-icon><RefreshLeft /></el-icon>重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleQuery">
|
||||
<el-icon><Search /></el-icon>搜索
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col v-if="hasContractPerm('changeAdd')" :span="1.5">
|
||||
<el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col v-if="hasContractPerm('changeRemove')" :span="1.5">
|
||||
<el-button type="danger" icon="Delete" :disabled="multiple || !allRowsDeletableByCreator(changeList.filter((item) => ids.includes(item.id)))" :title="allRowsDeletableByCreator(changeList.filter((item) => ids.includes(item.id))) ? '' : CREATOR_DELETE_TIP" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col v-if="hasContractPerm('changeExport')" :span="1.5">
|
||||
<el-button type="success" icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<el-table v-loading="loading" :data="changeList" @selection-change="handleSelectionChange" border>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="合同编号" align="center" prop="contractNo" width="150" :show-overflow-tooltip="true">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="handleViewContract(scope.row)">{{ scope.row.contractNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合同名称" prop="contractName" :show-overflow-tooltip="true" min-width="180" />
|
||||
<el-table-column label="变更类型" align="center" prop="changeType" width="120">
|
||||
<template #default="scope">
|
||||
<DictTag dict-type="crm_contract_change_type" :value="scope.row.changeType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="变更原因" prop="changeReason" :show-overflow-tooltip="true" min-width="200" />
|
||||
<el-table-column label="变更金额" align="right" prop="changeAmount" width="130">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.changeAmount">¥{{ scope.row.changeAmount.toLocaleString() }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审批状态" align="center" prop="approvalStatus" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.approvalStatus === 'pending'" type="warning">待审批</el-tag>
|
||||
<el-tag v-else-if="scope.row.approvalStatus === 'approved'" type="success">已通过</el-tag>
|
||||
<el-tag v-else-if="scope.row.approvalStatus === 'rejected'" type="danger">已驳回</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审批人" align="center" prop="approverName" width="100" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-tooltip v-if="hasContractPerm('changeQuery')" content="查看" placement="top">
|
||||
<el-button link type="primary" icon="View" @click="handleView(scope.row)" />
|
||||
</el-tooltip>
|
||||
<el-dropdown
|
||||
v-if="hasContractPerm('changeApprove') || hasContractPerm('changeRemove')"
|
||||
@command="(command) => handleCommand(command, scope.row)"
|
||||
trigger="click"
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
v-if="hasContractPerm('changeAdd')"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>
|
||||
<el-button link type="primary" icon="MoreFilled" />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item
|
||||
v-if="hasContractPerm('changeApprove') && scope.row.approvalStatus === 'pending'"
|
||||
command="submit"
|
||||
icon="Promotion"
|
||||
>提交审批</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-if="hasContractPerm('changeApprove') && scope.row.approvalStatus === 'approved'"
|
||||
command="execute"
|
||||
icon="VideoPlay"
|
||||
>执行变更</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-if="hasContractPerm('changeApprove') && scope.row.approvalStatus === 'pending'"
|
||||
command="withdraw"
|
||||
icon="RefreshLeft"
|
||||
>撤回</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-if="hasContractPerm('changeRemove') && scope.row.approvalStatus === 'pending' && canDeleteByCreator(scope.row)"
|
||||
command="delete"
|
||||
icon="Delete"
|
||||
divided
|
||||
>删除</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-icon><Plus /></el-icon>新增变更
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('changeRemove')"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length === 0 || !allRowsDeletableByCreator(selectedRows)"
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete()"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('changeApprove')"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1 || selectedRows[0]?.approvalStatus !== 'pending'"
|
||||
@click="handleSubmitApproval(selectedRows[0])"
|
||||
>
|
||||
<el-icon><Promotion /></el-icon>提交审批
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('changeApprove')"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1 || selectedRows[0]?.approvalStatus !== 'approved'"
|
||||
@click="handleExecute(selectedRows[0])"
|
||||
>
|
||||
<el-icon><VideoPlay /></el-icon>执行变更
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('changeApprove')"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1 || selectedRows[0]?.approvalStatus !== 'pending'"
|
||||
@click="handleWithdraw(selectedRows[0])"
|
||||
>
|
||||
<el-icon><RefreshLeft /></el-icon>撤回
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('changeExport')"
|
||||
class="btn-ghost"
|
||||
:loading="exportLoading"
|
||||
@click="handleExport"
|
||||
>
|
||||
<el-icon><Download /></el-icon>导出
|
||||
</el-button>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="合同" prop="contractId">
|
||||
<el-select v-model="form.contractId" placeholder="请选择合同" filterable style="width: 100%">
|
||||
<!-- TODO: 动态加载合同列表 -->
|
||||
<el-option label="合同1" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="变更类型" prop="changeType">
|
||||
<el-select v-model="form.changeType" placeholder="请选择变更类型" style="width: 100%">
|
||||
<el-option
|
||||
v-for="dict in dictStore.getOptions('crm_contract_change_type')"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="变更原因" prop="changeReason">
|
||||
<el-input v-model="form.changeReason" type="textarea" :rows="3" placeholder="请输入变更原因" />
|
||||
</el-form-item>
|
||||
<el-form-item label="变更内容" prop="changeContent">
|
||||
<el-input v-model="form.changeContent" type="textarea" :rows="2" placeholder="请输入变更内容描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="变更前值" prop="oldValue">
|
||||
<el-input v-model="form.oldValue" type="textarea" :rows="2" placeholder="请输入变更前的值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="变更后值" prop="newValue">
|
||||
<el-input v-model="form.newValue" type="textarea" :rows="2" placeholder="请输入变更后的值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="变更金额" prop="changeAmount">
|
||||
<el-input-number v-model="form.changeAmount" :precision="2" :min="0" controls-position="right" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="2" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<ListToolbarEndActions :loading="loading" @refresh="getList" />
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<!-- 查看详情 -->
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewDialog.visible"
|
||||
title="变更详情"
|
||||
:icon="Document"
|
||||
:code="viewDialog.data.contractNo"
|
||||
code-label="合同编号"
|
||||
:meta="viewDialog.data.contractName"
|
||||
:sections="changeViewSections"
|
||||
append-to-body
|
||||
/>
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
v-loading="loading"
|
||||
:data="changeList"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="contractNo"
|
||||
label="合同编号"
|
||||
min-width="150"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleViewContract(row)">{{ row.contractNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="contractName"
|
||||
label="合同名称"
|
||||
min-width="180"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="变更类型" min-width="120" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="dictStore.getTagType('crm_contract_change_type', row.changeType)"
|
||||
size="small"
|
||||
>
|
||||
{{ dictStore.getLabel('crm_contract_change_type', row.changeType) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="changeReason"
|
||||
label="变更原因"
|
||||
min-width="200"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="变更金额" min-width="130" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.changeAmount">¥{{ row.changeAmount.toLocaleString() }}</span>
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审批状态" min-width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.approvalStatus === 'pending'" type="warning" size="small">待审批</el-tag>
|
||||
<el-tag v-else-if="row.approvalStatus === 'approved'" type="success" size="small">已通过</el-tag>
|
||||
<el-tag v-else-if="row.approvalStatus === 'rejected'" type="danger" size="small">已驳回</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="approverName"
|
||||
label="审批人"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column label="创建时间" min-width="160" align="center" header-align="center">
|
||||
<template #default="{ row }">{{ parseTime(row.createTime) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
v-model:current-page="queryParams.pageNum"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
@size-change="getList"
|
||||
@current-change="getList"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
v-model="dialog.visible"
|
||||
:title="dialog.title"
|
||||
width="800px"
|
||||
class="dialog-form-layout order-module-dialog-mask"
|
||||
align-center
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
append-to-body
|
||||
@close="cancel"
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="top"
|
||||
scroll-to-error
|
||||
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
|
||||
>
|
||||
<div class="form-grid-2">
|
||||
<el-form-item label="合同" prop="contractId" class="form-col-span-2">
|
||||
<el-select v-model="form.contractId" placeholder="请选择合同" filterable style="width: 100%">
|
||||
<!-- TODO: 动态加载合同列表 -->
|
||||
<el-option label="合同1" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="变更类型" prop="changeType">
|
||||
<el-select v-model="form.changeType" placeholder="请选择变更类型" style="width: 100%">
|
||||
<el-option
|
||||
v-for="dict in dictStore.getOptions('crm_contract_change_type')"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="变更金额" prop="changeAmount">
|
||||
<el-input-number
|
||||
v-model="form.changeAmount"
|
||||
:precision="2"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="变更原因" prop="changeReason" class="form-col-span-2">
|
||||
<el-input v-model="form.changeReason" type="textarea" :rows="3" placeholder="请输入变更原因" />
|
||||
</el-form-item>
|
||||
<el-form-item label="变更内容" prop="changeContent" class="form-col-span-2">
|
||||
<el-input v-model="form.changeContent" type="textarea" :rows="2" placeholder="请输入变更内容描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="变更前值" prop="oldValue" class="form-col-span-2">
|
||||
<el-input v-model="form.oldValue" type="textarea" :rows="2" placeholder="请输入变更前的值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="变更后值" prop="newValue" class="form-col-span-2">
|
||||
<el-input v-model="form.newValue" type="textarea" :rows="2" placeholder="请输入变更后的值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark" class="form-col-span-2">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="2" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button class="btn-ghost" @click="cancel">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" :loading="submitLoading" @click="submitForm">
|
||||
<el-icon><Check /></el-icon>确定
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewDialog.visible"
|
||||
title="变更详情"
|
||||
:icon="Document"
|
||||
:code="viewDialog.data.contractNo"
|
||||
code-label="合同编号"
|
||||
:meta="viewDialog.data.contractName"
|
||||
:sections="changeViewSections"
|
||||
append-to-body
|
||||
>
|
||||
<template #hero-actions>
|
||||
<div class="change-view-hero-actions">
|
||||
<el-button
|
||||
v-if="hasContractPerm('changeApprove') && viewDialog.data.approvalStatus === 'pending'"
|
||||
class="btn-ghost"
|
||||
@click="handleSubmitApproval(viewDialog.data)"
|
||||
>
|
||||
<el-icon><Promotion /></el-icon>提交审批
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('changeApprove') && viewDialog.data.approvalStatus === 'approved'"
|
||||
class="btn-ghost"
|
||||
@click="handleExecute(viewDialog.data)"
|
||||
>
|
||||
<el-icon><VideoPlay /></el-icon>执行变更
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('changeApprove') && viewDialog.data.approvalStatus === 'pending'"
|
||||
class="btn-ghost"
|
||||
@click="handleWithdraw(viewDialog.data)"
|
||||
>
|
||||
<el-icon><RefreshLeft /></el-icon>撤回
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="
|
||||
hasContractPerm('changeRemove') &&
|
||||
viewDialog.data.approvalStatus === 'pending' &&
|
||||
canDeleteByCreator(viewDialog.data)
|
||||
"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
@click="handleDetailDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ContractChange">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { Document } from '@element-plus/icons-vue'
|
||||
import {
|
||||
Document,
|
||||
Plus,
|
||||
Delete,
|
||||
Download,
|
||||
Search,
|
||||
RefreshLeft,
|
||||
Close,
|
||||
Check,
|
||||
Promotion,
|
||||
VideoPlay
|
||||
} from '@element-plus/icons-vue'
|
||||
import SystemViewDialog, {
|
||||
type ViewField,
|
||||
type ViewSection
|
||||
@@ -235,28 +376,30 @@ import {
|
||||
} from '@/api/crm/contract/change'
|
||||
import { parseTime } from '@/utils/format'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import DictTag from '@/components/DictTag/index.vue'
|
||||
import { $modal } from '@/utils/modal'
|
||||
import { useContractPerm } from '@/hooks/business/useContractPerm'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import {
|
||||
canDeleteByCreator,
|
||||
filterDeletableByCreator,
|
||||
allRowsDeletableByCreator,
|
||||
CREATOR_DELETE_TIP
|
||||
} from '@/utils/creator-delete'
|
||||
|
||||
const router = useRouter()
|
||||
const dictStore = useDictStore()
|
||||
const { loadPerms, hasContractPerm } = useContractPerm()
|
||||
|
||||
// 查询参数
|
||||
const queryParams = ref<ChangeQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
contractNo: undefined,
|
||||
contractName: undefined,
|
||||
changeType: undefined,
|
||||
approvalStatus: undefined,
|
||||
beginTime: undefined,
|
||||
endTime: undefined
|
||||
});
|
||||
})
|
||||
|
||||
// 表单数据
|
||||
const form = ref<ChangeForm>({
|
||||
contractId: 0,
|
||||
changeType: '',
|
||||
@@ -266,37 +409,33 @@ const form = ref<ChangeForm>({
|
||||
newValue: '',
|
||||
changeAmount: 0,
|
||||
remark: ''
|
||||
});
|
||||
})
|
||||
|
||||
// 表单校验规则
|
||||
const rules = ref({
|
||||
contractId: [{ required: true, message: '请选择合同', trigger: 'change' }],
|
||||
changeType: [{ required: true, message: '请选择变更类型', trigger: 'change' }],
|
||||
changeReason: [{ required: true, message: '请输入变更原因', trigger: 'blur' }],
|
||||
newValue: [{ required: true, message: '请输入变更后的值', trigger: 'blur' }]
|
||||
});
|
||||
})
|
||||
|
||||
// 数据列表
|
||||
const changeList = ref<ChangeVO[]>([]);
|
||||
const loading = ref(true);
|
||||
const total = ref(0);
|
||||
const showSearch = ref(false);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const ids = ref<number[]>([]);
|
||||
const dateRange = ref<[string, string]>();
|
||||
const changeList = ref<ChangeVO[]>([])
|
||||
const selectedRows = ref<ChangeVO[]>([])
|
||||
const loading = ref(true)
|
||||
const submitLoading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const total = ref(0)
|
||||
const ids = ref<number[]>([])
|
||||
const dateRange = ref<[string, string]>()
|
||||
|
||||
// 对话框
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
})
|
||||
|
||||
// 查看详情对话框
|
||||
const viewDialog = reactive({
|
||||
visible: false,
|
||||
data: {} as ChangeVO
|
||||
});
|
||||
})
|
||||
|
||||
function changeStatusTag(status?: string) {
|
||||
if (status === 'pending') return { label: '待审批', type: 'warning' as const }
|
||||
@@ -358,105 +497,87 @@ const changeViewSections = computed<ViewSection[]>(() => {
|
||||
]
|
||||
})
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const formRef = ref<ElFormInstance>();
|
||||
const queryFormRef = ref<ElFormInstance>()
|
||||
const formRef = ref<ElFormInstance>()
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
try {
|
||||
// 处理日期范围
|
||||
if (dateRange.value && dateRange.value.length === 2) {
|
||||
queryParams.value.beginTime = dateRange.value[0];
|
||||
queryParams.value.endTime = dateRange.value[1];
|
||||
queryParams.value.beginTime = dateRange.value[0]
|
||||
queryParams.value.endTime = dateRange.value[1]
|
||||
} else {
|
||||
queryParams.value.beginTime = undefined;
|
||||
queryParams.value.endTime = undefined;
|
||||
queryParams.value.beginTime = undefined
|
||||
queryParams.value.endTime = undefined
|
||||
}
|
||||
|
||||
const res = await listChange(queryParams.value);
|
||||
changeList.value = res.rows;
|
||||
total.value = res.total;
|
||||
const res = await listChange(queryParams.value)
|
||||
changeList.value = res.rows
|
||||
total.value = res.total
|
||||
} finally {
|
||||
loading.value = false;
|
||||
loading.value = false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
dateRange.value = undefined;
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
dateRange.value = undefined
|
||||
queryFormRef.value?.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: ChangeVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length !== 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
selectedRows.value = selection
|
||||
ids.value = selection.map((item) => item.id)
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = '添加变更记录';
|
||||
};
|
||||
reset()
|
||||
dialog.visible = true
|
||||
dialog.title = '添加变更记录'
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row: ChangeVO) => {
|
||||
reset();
|
||||
const res = await getChange(row.id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改变更记录';
|
||||
};
|
||||
|
||||
/** 查看详情 */
|
||||
const handleView = async (row: ChangeVO) => {
|
||||
const res = await getChange(row.id);
|
||||
viewDialog.data = res.data;
|
||||
viewDialog.visible = true;
|
||||
};
|
||||
const res = await getChange(row.id)
|
||||
viewDialog.data = res.data
|
||||
viewDialog.visible = true
|
||||
}
|
||||
|
||||
/** 查看合同 */
|
||||
const handleViewContract = (row: ChangeVO) => {
|
||||
router.push({
|
||||
path: '/crm/contract/detail',
|
||||
query: { id: row.contractId }
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
if (form.value.id) {
|
||||
await updateChange(form.value);
|
||||
$modal.msgSuccess('修改成功')
|
||||
} else {
|
||||
await addChange(form.value)
|
||||
$modal.msgSuccess('新增成功')
|
||||
}
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
if (!valid) return
|
||||
submitLoading.value = true
|
||||
try {
|
||||
if (form.value.id) {
|
||||
await updateChange(form.value)
|
||||
$modal.msgSuccess('修改成功')
|
||||
} else {
|
||||
await addChange(form.value)
|
||||
$modal.msgSuccess('新增成功')
|
||||
}
|
||||
dialog.visible = false
|
||||
await getList()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
submitLoading.value = false
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ChangeVO) => {
|
||||
const targets = row ? [row] : changeList.value.filter((item) => ids.value.includes(item.id))
|
||||
const targets = row ? [row] : selectedRows.value
|
||||
const deletable = filterDeletableByCreator(targets)
|
||||
if (!deletable.length) {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
@@ -466,57 +587,57 @@ const handleDelete = async (row?: ChangeVO) => {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
const idList = row?.id ? [row.id] : ids.value;
|
||||
const idList = row?.id ? [row.id] : ids.value
|
||||
await $modal.confirm('是否确认删除选中的变更记录?')
|
||||
await delChange(idList)
|
||||
$modal.msgSuccess('删除成功')
|
||||
await getList();
|
||||
};
|
||||
await getList()
|
||||
}
|
||||
|
||||
async function handleDetailDelete() {
|
||||
if (!viewDialog.data?.id) return
|
||||
await handleDelete(viewDialog.data as ChangeVO)
|
||||
viewDialog.visible = false
|
||||
}
|
||||
|
||||
/** 下拉菜单命令处理 */
|
||||
const handleCommand = async (command: string, row: ChangeVO) => {
|
||||
switch (command) {
|
||||
case 'submit':
|
||||
await handleSubmitApproval(row);
|
||||
break;
|
||||
await handleSubmitApproval(row)
|
||||
break
|
||||
case 'execute':
|
||||
await handleExecute(row);
|
||||
break;
|
||||
await handleExecute(row)
|
||||
break
|
||||
case 'withdraw':
|
||||
await handleWithdraw(row);
|
||||
break;
|
||||
await handleWithdraw(row)
|
||||
break
|
||||
case 'delete':
|
||||
await handleDelete(row);
|
||||
break;
|
||||
await handleDelete(row)
|
||||
break
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** 提交审批 */
|
||||
const handleSubmitApproval = async (row: ChangeVO) => {
|
||||
await $modal.confirm('是否确认提交该变更记录进行审批?')
|
||||
// TODO: 选择审批人
|
||||
await submitChangeApproval({ id: row.id, approverIds: [] })
|
||||
$modal.msgSuccess('提交成功')
|
||||
await getList();
|
||||
};
|
||||
await getList()
|
||||
}
|
||||
|
||||
/** 执行变更 */
|
||||
const handleExecute = async (row: ChangeVO) => {
|
||||
await $modal.confirm('是否确认执行该变更?执行后将无法撤销')
|
||||
await executeChange(row.id)
|
||||
$modal.msgSuccess('执行成功')
|
||||
await getList();
|
||||
};
|
||||
await getList()
|
||||
}
|
||||
|
||||
/** 撤回变更 */
|
||||
const handleWithdraw = async (row: ChangeVO) => {
|
||||
await $modal.confirm('是否确认撤回该变更记录?')
|
||||
await withdrawChange(row.id)
|
||||
$modal.msgSuccess('撤回成功')
|
||||
await getList();
|
||||
};
|
||||
await getList()
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
if (dateRange.value && dateRange.value.length === 2) {
|
||||
queryParams.value.beginTime = dateRange.value[0]
|
||||
@@ -525,6 +646,7 @@ const handleExport = async () => {
|
||||
queryParams.value.beginTime = undefined
|
||||
queryParams.value.endTime = undefined
|
||||
}
|
||||
exportLoading.value = true
|
||||
try {
|
||||
const res = await exportChange(queryParams.value)
|
||||
const blob =
|
||||
@@ -542,16 +664,16 @@ const handleExport = async () => {
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
$modal.msgError('导出失败')
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
dialog.visible = false;
|
||||
reset();
|
||||
};
|
||||
dialog.visible = false
|
||||
reset()
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = {
|
||||
id: undefined,
|
||||
@@ -563,19 +685,12 @@ const reset = () => {
|
||||
newValue: '',
|
||||
changeAmount: 0,
|
||||
remark: ''
|
||||
};
|
||||
formRef.value?.resetFields();
|
||||
};
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadPerms()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.text-content {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
@@ -362,7 +362,13 @@
|
||||
</div>
|
||||
<div class="list-body list-wrap">
|
||||
<el-table :data="detailPaymentList" class="list-table" stripe v-loading="detailPaymentLoading" empty-text="暂无回款记录">
|
||||
<el-table-column label="回款单号" prop="paymentNo" min-width="150" align="center" header-align="center" />
|
||||
<el-table-column label="回款单号" prop="paymentNo" min-width="150" align="center" header-align="center">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="handleDetailViewPayment(scope.row)">
|
||||
{{ scope.row.paymentNo }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="回款金额" prop="amount" min-width="130" align="right">
|
||||
<template #default="scope">
|
||||
<span class="text-success font-weight-bold"
|
||||
@@ -376,13 +382,6 @@
|
||||
<el-table-column label="创建人" prop="createBy" width="100" align="center" />
|
||||
<el-table-column label="创建时间" prop="createTime" width="160" align="center">
|
||||
<template #default="scope">{{ parseTime(scope.row.createTime) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="120" align="center" header-align="center" fixed="right" class-name="col-actions">
|
||||
<template #default="scope">
|
||||
<el-button link type="success" @click="handleDetailViewPayment(scope.row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
@@ -403,7 +402,13 @@
|
||||
</div>
|
||||
<div class="list-body list-wrap">
|
||||
<el-table :data="detailInvoiceList" class="list-table" stripe v-loading="detailInvoiceLoading" empty-text="暂无开票记录">
|
||||
<el-table-column label="发票号码" prop="invoiceNo" min-width="150" align="center" header-align="center" />
|
||||
<el-table-column label="发票号码" prop="invoiceNo" min-width="150" align="center" header-align="center">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="handleDetailViewInvoice(scope.row)">
|
||||
{{ scope.row.invoiceNo }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发票类型" prop="invoiceType" width="120" align="center" />
|
||||
<el-table-column label="开票金额" prop="amount" min-width="130" align="right">
|
||||
<template #default="scope">
|
||||
@@ -417,13 +422,6 @@
|
||||
<el-table-column label="创建人" prop="createBy" width="100" align="center" />
|
||||
<el-table-column label="创建时间" prop="createTime" width="160" align="center">
|
||||
<template #default="scope">{{ parseTime(scope.row.createTime) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="120" align="center" header-align="center" fixed="right" class-name="col-actions">
|
||||
<template #default="scope">
|
||||
<el-button link type="success" @click="handleDetailViewInvoice(scope.row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -188,7 +188,7 @@ watch(dialogVisible, (val) => {
|
||||
// 查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
productName: undefined,
|
||||
categoryId: undefined,
|
||||
status: 'on' // on-上架 off-下架
|
||||
|
||||
@@ -1,84 +1,81 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-page-header @back="goBack" content="合同详情" />
|
||||
|
||||
<el-card class="mt-4" v-loading="loading">
|
||||
<!-- 头部操作按钮 -->
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<div class="header-left">
|
||||
<span class="card-title">{{ contract?.contractNo }} - {{ contract?.contractName }}</span>
|
||||
<div class="page-container contract-detail-page">
|
||||
<section class="panel" v-loading="loading">
|
||||
<div class="panel-top panel-top-with-actions">
|
||||
<div class="panel-top-main">
|
||||
<h2 class="title-bar-heading">合同详情</h2>
|
||||
<div v-if="contract" class="header-left header-tags">
|
||||
<el-tag
|
||||
v-if="contract?.status"
|
||||
:type="dictStore.getTagType('crm_contract_status', contract.status)"
|
||||
size="large"
|
||||
class="ml-2"
|
||||
size="small"
|
||||
>{{ dictStore.getLabel('crm_contract_status', contract.status) }}</el-tag>
|
||||
<el-tag
|
||||
v-if="contract?.approvalStatus"
|
||||
:type="dictStore.getTagType('crm_approval_status', contract.approvalStatus)"
|
||||
size="large"
|
||||
class="ml-2"
|
||||
size="small"
|
||||
>{{ dictStore.getLabel('crm_approval_status', contract.approvalStatus) }}</el-tag>
|
||||
</div>
|
||||
<div>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="Edit"
|
||||
@click="handleEdit"
|
||||
v-if="hasContractPerm('edit') && contract?.status === 'draft'"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('remove') && canDeleteByCreator(contract)"
|
||||
type="danger"
|
||||
icon="Delete"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
icon="Promotion"
|
||||
@click="handleSubmit"
|
||||
v-if="hasContractPerm('submit') && contract?.status === 'draft'"
|
||||
>提交审批</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
icon="VideoPlay"
|
||||
@click="handleExecute"
|
||||
v-if="hasContractPerm('execute') && contract?.status === 'approved' && contract?.approvalStatus === 'approved'"
|
||||
>开始执行</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="CircleCheck"
|
||||
@click="handleComplete"
|
||||
v-if="hasContractPerm('finish') && contract?.status === 'executing'"
|
||||
>完成合同</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="CircleClose"
|
||||
@click="handleInvalid"
|
||||
v-if="hasContractPerm('invalid') && ['draft', 'approving', 'approved', 'executing'].includes(contract?.status || '')"
|
||||
>作废</el-button
|
||||
>
|
||||
<el-button
|
||||
icon="Printer"
|
||||
@click="handlePrint"
|
||||
v-if="hasContractPerm('print')"
|
||||
:disabled="contract?.contractTemplate === 'customer'"
|
||||
>打印</el-button>
|
||||
<!-- <el-button
|
||||
type="warning"
|
||||
icon="RefreshRight"
|
||||
@click="handleRenew"
|
||||
v-if="['executing', 'finished'].includes(contract?.status || '')"
|
||||
|
||||
>发起续签</el-button
|
||||
> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div class="detail-toolbar">
|
||||
<el-button class="btn-ghost" @click="goBack">
|
||||
<el-icon><Back /></el-icon>返回
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="handleEdit"
|
||||
v-if="hasContractPerm('edit') && contract?.status === 'draft'"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('remove') && canDeleteByCreator(contract)"
|
||||
type="danger"
|
||||
@click="handleDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
@click="handleSubmit"
|
||||
v-if="hasContractPerm('submit') && contract?.status === 'draft'"
|
||||
>
|
||||
<el-icon><Promotion /></el-icon>提交审批
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
@click="handleExecute"
|
||||
v-if="hasContractPerm('execute') && contract?.status === 'approved' && contract?.approvalStatus === 'approved'"
|
||||
>
|
||||
<el-icon><VideoPlay /></el-icon>开始执行
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="handleComplete"
|
||||
v-if="hasContractPerm('finish') && contract?.status === 'executing'"
|
||||
>
|
||||
<el-icon><CircleCheck /></el-icon>完成合同
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
@click="handleInvalid"
|
||||
v-if="hasContractPerm('invalid') && ['draft', 'approving', 'approved', 'executing'].includes(contract?.status || '')"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="handlePrint"
|
||||
v-if="hasContractPerm('print')"
|
||||
:disabled="contract?.contractTemplate === 'customer'"
|
||||
>
|
||||
<el-icon><Printer /></el-icon>打印
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-tabs v-model="activeTab">
|
||||
<p v-if="contract" class="detail-subtitle">{{ contract.contractNo }} — {{ contract.contractName }}</p>
|
||||
|
||||
<el-tabs v-model="activeTab" class="panel-pill-tabs panel-pill-tabs--lg">
|
||||
<!-- 合同信息 -->
|
||||
<el-tab-pane label="合同信息" name="contract">
|
||||
<el-form label-width="120px" v-if="contract">
|
||||
@@ -956,7 +953,7 @@
|
||||
<el-empty v-if="operLogList.length === 0 && !logLoading" description="暂无操作日志" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
</section>
|
||||
|
||||
<!-- 审批对话框 -->
|
||||
<ApprovalDialog ref="approvalDialogRef" @success="loadContractDetail" />
|
||||
@@ -1009,7 +1006,7 @@ import { $modal } from '@/utils/modal';
|
||||
import { useDictStore } from '@/store/modules/dict';
|
||||
import DictTag from '@/components/DictTag/index.vue';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { CircleCheck, CircleClose, View, ChatLineSquare, Clock, InfoFilled, VideoPlay, Document, Paperclip, Download } from '@element-plus/icons-vue';
|
||||
import { CircleCheck, CircleClose, View, ChatLineSquare, Clock, InfoFilled, VideoPlay, Document, Paperclip, Download, Back, Edit, Delete, Promotion, Printer } from '@element-plus/icons-vue';
|
||||
import ApprovalDialog from './components/ApprovalDialog.vue';
|
||||
import ExecuteDialog from './components/ExecuteDialog.vue';
|
||||
import InvalidDialog from './components/InvalidDialog.vue';
|
||||
@@ -1064,7 +1061,7 @@ const logLoading = ref(false);
|
||||
const logTotal = ref(0);
|
||||
const logQuery = ref<OperLogQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
pageSize: 20
|
||||
} as OperLogQuery);
|
||||
|
||||
// 组件引用
|
||||
@@ -2649,6 +2646,29 @@ const handleGeneratePdfFile = async () => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.contract-detail-page {
|
||||
.detail-subtitle {
|
||||
margin: 0;
|
||||
padding: 0 16px 12px;
|
||||
font-size: 13px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
}
|
||||
|
||||
.header-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.detail-toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -2697,7 +2717,7 @@ const handleGeneratePdfFile = async () => {
|
||||
font-weight: bold;
|
||||
|
||||
&.primary {
|
||||
color: #409eff;
|
||||
color: var(--primary, #10b981);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card class="box-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="card-title">{{ formTitle }}</span>
|
||||
<el-button style="float: right" @click="handleBack">返回</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 步骤条已移除 -->
|
||||
<div class="page-container contract-form-page">
|
||||
<section class="panel">
|
||||
<div class="panel-top panel-top-with-actions">
|
||||
<h2 class="title-bar-heading">{{ formTitle }}</h2>
|
||||
<el-button class="btn-ghost" @click="handleBack">
|
||||
<el-icon><Back /></el-icon>返回
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
|
||||
<!-- 合同信息(融合基本信息+合同条款+产品明细) -->
|
||||
@@ -535,7 +533,7 @@
|
||||
<el-button @click="handleBack">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</section>
|
||||
|
||||
<!-- 产品选择器 -->
|
||||
<ProductSelector :visible="productSelectorVisible" @update:visible="productSelectorVisible = $event" @confirm="handleProductSelected" />
|
||||
@@ -583,7 +581,7 @@ import {
|
||||
import { useDictStore } from '@/store/modules/dict';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { $modal } from '@/utils/modal';
|
||||
import { UploadFilled, Document, Loading, Download, Delete, ZoomIn, Sort, Plus } from '@element-plus/icons-vue';
|
||||
import { UploadFilled, Document, Loading, Download, Delete, ZoomIn, Sort, Plus, Back } from '@element-plus/icons-vue';
|
||||
import ImagePreview from '@/components/ImagePreview/index.vue';
|
||||
import {
|
||||
buildUploadFileListFromField,
|
||||
@@ -2494,8 +2492,9 @@ onMounted(async () => {
|
||||
.total-section {
|
||||
margin-top: 20px;
|
||||
padding: 15px;
|
||||
background-color: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
background-color: var(--mint-row-hover, #f1f5f9);
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--mint-border, #d9e8e2);
|
||||
}
|
||||
|
||||
.total-item {
|
||||
|
||||
@@ -5,17 +5,19 @@
|
||||
<h2 class="title-bar-heading">合同管理</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-tabs">
|
||||
<el-tabs v-model="activeView" @tab-change="handleViewChange">
|
||||
<el-tab-pane label="我的合同" name="my" />
|
||||
<el-tab-pane label="全部合同" name="all" />
|
||||
<el-tab-pane label="待审批" name="submitted" />
|
||||
<el-tab-pane label="已审批" name="approved" />
|
||||
<el-tab-pane label="执行中" name="executing" />
|
||||
<el-tab-pane label="已完成" name="finished" />
|
||||
<el-tab-pane label="已作废" name="invalid" />
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-tabs
|
||||
v-model="activeView"
|
||||
class="panel-pill-tabs panel-pill-tabs--lg"
|
||||
@tab-change="handleViewChange"
|
||||
>
|
||||
<el-tab-pane label="我的合同" name="my" />
|
||||
<el-tab-pane label="全部合同" name="all" />
|
||||
<el-tab-pane label="待审批" name="submitted" />
|
||||
<el-tab-pane label="已审批" name="approved" />
|
||||
<el-tab-pane label="执行中" name="executing" />
|
||||
<el-tab-pane label="已完成" name="finished" />
|
||||
<el-tab-pane label="已作废" name="invalid" />
|
||||
</el-tabs>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form ref="queryFormRef" :model="queryParams" class="filter-form" @submit.prevent>
|
||||
@@ -155,6 +157,28 @@
|
||||
<el-button v-if="hasContractPerm('add')" class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('edit')"
|
||||
class="btn-ghost"
|
||||
:disabled="single || selectedRows[0]?.status !== 'draft'"
|
||||
@click="handleUpdate()"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('remove')"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="
|
||||
multiple ||
|
||||
!selectedRows.every((row) => row.status === 'draft') ||
|
||||
!allRowsDeletableByCreator(selectedRows)
|
||||
"
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete()"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('submit') && activeView === 'my'"
|
||||
class="btn-ghost"
|
||||
@@ -190,12 +214,16 @@
|
||||
<el-button v-if="hasContractPerm('export')" class="btn-ghost" :loading="exportLoading" @click="handleExport">
|
||||
<el-icon><Download /></el-icon>导出
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleColumnSetting">
|
||||
<el-icon><Setting /></el-icon>列设置
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loading" @click="getList">
|
||||
<el-icon><Refresh /></el-icon>刷新
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="getList"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -443,23 +471,6 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column v-if="isColumnVisible('remark')" label="备注" align="center" prop="remark" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column label="操作" min-width="260" align="center" header-align="center" fixed="right" class-name="col-actions">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button v-if="hasContractPerm('query')" class="btn-op-item" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('edit')"
|
||||
class="btn-op-item primary"
|
||||
:disabled="row.status !== 'draft'"
|
||||
@click="handleUpdate(row)"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -492,38 +503,6 @@
|
||||
<ContractDetailDialog ref="contractDetailRef" @success="getList" />
|
||||
|
||||
|
||||
<!-- 列设置对话框 -->
|
||||
<el-dialog
|
||||
v-model="columnSettingDialog.visible"
|
||||
title="列设置"
|
||||
width="600px"
|
||||
align-center
|
||||
append-to-body
|
||||
class="dialog-form-layout"
|
||||
modal-class="order-module-dialog-mask"
|
||||
>
|
||||
<div class="column-setting-content">
|
||||
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">全选</el-checkbox>
|
||||
<el-divider />
|
||||
<el-checkbox-group v-model="visibleColumns" @change="handleCheckedColumnsChange">
|
||||
<div v-for="col in tableColumns" :key="col.prop" class="column-item">
|
||||
<el-checkbox :label="col.prop" :disabled="col.fixed">{{ col.label }}</el-checkbox>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button class="btn-ghost" @click="handleResetColumns">
|
||||
<el-icon><RefreshLeft /></el-icon>恢复默认
|
||||
</el-button>
|
||||
<el-button @click="columnSettingDialog.visible = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button type="primary" @click="handleSaveColumnSetting">
|
||||
<el-icon><Check /></el-icon>保存
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 合同表单对话框 -->
|
||||
<ContractFormDialog
|
||||
v-model:visible="formDialogVisible"
|
||||
@@ -546,7 +525,6 @@ import {
|
||||
import {
|
||||
ArrowDownBold,
|
||||
ArrowUpBold,
|
||||
Check,
|
||||
CircleCheck,
|
||||
CircleClose,
|
||||
Clock,
|
||||
@@ -556,13 +534,10 @@ import {
|
||||
Download,
|
||||
Edit,
|
||||
Plus,
|
||||
Refresh,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
Select,
|
||||
Setting,
|
||||
Upload,
|
||||
View
|
||||
Upload
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
const dictStore = useDictStore()
|
||||
@@ -571,7 +546,7 @@ import { $modal } from '@/utils/modal'
|
||||
import { parseTime } from '@/utils/format'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { useContractPerm } from '@/hooks/business/useContractPerm'
|
||||
import { filterDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import ApprovalDialog from './components/ApprovalDialog.vue'
|
||||
import ExecuteDialog from './components/ExecuteDialog.vue'
|
||||
import InvalidDialog from './components/InvalidDialog.vue'
|
||||
@@ -586,7 +561,9 @@ import {
|
||||
getCrmAttachmentCategoryLabel,
|
||||
isCrmImageFile,
|
||||
resolveCrmAttachmentFiles
|
||||
} from '@/utils/crm-attachment';
|
||||
} from '@/utils/crm-attachment'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
|
||||
const userStore = useUserStore();
|
||||
const exportLoading = ref(false);
|
||||
@@ -615,135 +592,64 @@ const formDialogEditId = ref<string | null>(null)
|
||||
|
||||
const { loadPerms, hasContractPerm } = useContractPerm()
|
||||
|
||||
// 列配置相关
|
||||
const COLUMN_STORAGE_KEY = 'crm_contract_visible_columns';
|
||||
// 列配置
|
||||
const listColumnDefs = [
|
||||
{ prop: 'customerName', label: '客户名称' },
|
||||
{ prop: 'contactName', label: '联系人' },
|
||||
{ prop: 'contactMobile', label: '联系人手机' },
|
||||
{ prop: 'contractType', label: '合同类型' },
|
||||
{ prop: 'renewalCount', label: '续签次数' },
|
||||
{ prop: 'attachmentFiles', label: '合同附件' },
|
||||
{ prop: 'amount', label: '合同金额(元)' },
|
||||
{ prop: 'receivedAmount', label: '已回款' },
|
||||
{ prop: 'unreceivedAmount', label: '未回款' },
|
||||
{ prop: 'receivedRate', label: '回款进度' },
|
||||
{ prop: 'invoiceAmount', label: '已开票金额' },
|
||||
{ prop: 'uninvoiceAmount', label: '未开票金额' },
|
||||
{ prop: 'status', label: '合同状态' },
|
||||
{ prop: 'approvalStatus', label: '审批状态' },
|
||||
{ prop: 'signDate', label: '签订日期' },
|
||||
{ prop: 'startDate', label: '开始日期' },
|
||||
{ prop: 'endDate', label: '结束日期' },
|
||||
{ prop: 'paymentMethod', label: '付款方式' },
|
||||
{ prop: 'partyA', label: '甲方' },
|
||||
{ prop: 'partyB', label: '乙方' },
|
||||
{ prop: 'settlementMethod', label: '结算方式' },
|
||||
{ prop: 'ownerUserName', label: '负责人' },
|
||||
{ prop: 'createDeptName', label: '创建部门' },
|
||||
{ prop: 'createByName', label: '创建人' },
|
||||
{ prop: 'createTime', label: '创建时间' },
|
||||
{ prop: 'updateByName', label: '更新人' },
|
||||
{ prop: 'updateTime', label: '更新时间' },
|
||||
{ prop: 'remark', label: '备注' }
|
||||
]
|
||||
|
||||
// 定义所有列配置(顺序代表显示顺序)
|
||||
const tableColumns = ref([
|
||||
{ prop: 'customerName', label: '客户名称', fixed: false },
|
||||
{ prop: 'contactName', label: '联系人', fixed: false },
|
||||
{ prop: 'contactMobile', label: '联系人手机', fixed: false },
|
||||
{ prop: 'contractType', label: '合同类型', fixed: false },
|
||||
{ prop: 'renewalCount', label: '续签次数', fixed: false },
|
||||
{ prop: 'attachmentFiles', label: '合同附件', fixed: false },
|
||||
{ prop: 'amount', label: '合同金额(元)', fixed: false },
|
||||
{ prop: 'receivedAmount', label: '已回款', fixed: false },
|
||||
{ prop: 'unreceivedAmount', label: '未回款', fixed: false },
|
||||
{ prop: 'receivedRate', label: '回款进度', fixed: false },
|
||||
{ prop: 'invoiceAmount', label: '已开票金额', fixed: false },
|
||||
{ prop: 'uninvoiceAmount', label: '未开票金额', fixed: false },
|
||||
{ prop: 'status', label: '合同状态', fixed: false },
|
||||
{ prop: 'approvalStatus', label: '审批状态', fixed: false },
|
||||
{ prop: 'signDate', label: '签订日期', fixed: false },
|
||||
{ prop: 'startDate', label: '开始日期', fixed: false },
|
||||
{ prop: 'endDate', label: '结束日期', fixed: false },
|
||||
{ prop: 'paymentMethod', label: '付款方式', fixed: false },
|
||||
{ prop: 'partyA', label: '甲方', fixed: false },
|
||||
{ prop: 'partyB', label: '乙方', fixed: false },
|
||||
{ prop: 'settlementMethod', label: '结算方式', fixed: false },
|
||||
{ prop: 'ownerUserName', label: '负责人', fixed: false },
|
||||
{ prop: 'createDeptName', label: '创建部门', fixed: false },
|
||||
{ prop: 'createByName', label: '创建人', fixed: false },
|
||||
{ prop: 'createTime', label: '创建时间', fixed: false },
|
||||
{ prop: 'updateByName', label: '更新人', fixed: false },
|
||||
{ prop: 'updateTime', label: '更新时间', fixed: false },
|
||||
{ prop: 'remark', label: '备注', fixed: false }
|
||||
]);
|
||||
|
||||
// 默认显示的列(现有字段)
|
||||
const defaultVisibleColumns = [
|
||||
'customerName',
|
||||
'contractType',
|
||||
'attachmentFiles',
|
||||
'amount',
|
||||
'receivedAmount',
|
||||
'receivedRate',
|
||||
'status',
|
||||
'approvalStatus',
|
||||
'ownerUserName',
|
||||
'signDate',
|
||||
'createTime'
|
||||
];
|
||||
|
||||
// 当前显示的列
|
||||
const visibleColumns = ref<string[]>([]);
|
||||
|
||||
// 列设置对话框
|
||||
const columnSettingDialog = reactive({
|
||||
visible: false
|
||||
});
|
||||
|
||||
// 全选状态
|
||||
const checkAll = ref(false);
|
||||
const isIndeterminate = ref(false);
|
||||
|
||||
/** 初始化列配置 */
|
||||
const initColumnSetting = () => {
|
||||
const savedColumns = localStorage.getItem(COLUMN_STORAGE_KEY);
|
||||
if (savedColumns) {
|
||||
try {
|
||||
visibleColumns.value = JSON.parse(savedColumns);
|
||||
} catch (error) {
|
||||
console.error('解析列配置失败:', error);
|
||||
visibleColumns.value = [...defaultVisibleColumns];
|
||||
}
|
||||
} else {
|
||||
visibleColumns.value = [...defaultVisibleColumns];
|
||||
}
|
||||
updateCheckAllStatus();
|
||||
};
|
||||
|
||||
/** 判断列是否显示 */
|
||||
const isColumnVisible = (prop: string) => {
|
||||
return visibleColumns.value.includes(prop);
|
||||
};
|
||||
|
||||
/** 打开列设置对话框 */
|
||||
const handleColumnSetting = () => {
|
||||
columnSettingDialog.visible = true;
|
||||
};
|
||||
|
||||
/** 全选/取消全选 */
|
||||
const handleCheckAllChange = (val: boolean) => {
|
||||
visibleColumns.value = val ? tableColumns.value.map((col) => col.prop) : [];
|
||||
isIndeterminate.value = false;
|
||||
};
|
||||
|
||||
/** 列选择变化 */
|
||||
const handleCheckedColumnsChange = () => {
|
||||
updateCheckAllStatus();
|
||||
};
|
||||
|
||||
/** 更新全选状态 */
|
||||
const updateCheckAllStatus = () => {
|
||||
const checkedCount = visibleColumns.value.length;
|
||||
const totalCount = tableColumns.value.length;
|
||||
checkAll.value = checkedCount === totalCount;
|
||||
isIndeterminate.value = checkedCount > 0 && checkedCount < totalCount;
|
||||
};
|
||||
|
||||
/** 恢复默认列设置 */
|
||||
const handleResetColumns = () => {
|
||||
visibleColumns.value = [...defaultVisibleColumns];
|
||||
updateCheckAllStatus();
|
||||
};
|
||||
|
||||
/** 保存列设置 */
|
||||
const handleSaveColumnSetting = () => {
|
||||
try {
|
||||
localStorage.setItem(COLUMN_STORAGE_KEY, JSON.stringify(visibleColumns.value));
|
||||
$modal.msgSuccess('列设置保存成功');
|
||||
columnSettingDialog.visible = false;
|
||||
} catch (error) {
|
||||
console.error('保存列配置失败:', error);
|
||||
$modal.msgError('保存列设置失败');
|
||||
}
|
||||
};
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('crm_contract_visible_columns', listColumnDefs, {
|
||||
defaultVisibleProps: [
|
||||
'customerName',
|
||||
'contractType',
|
||||
'attachmentFiles',
|
||||
'amount',
|
||||
'receivedAmount',
|
||||
'receivedRate',
|
||||
'status',
|
||||
'approvalStatus',
|
||||
'ownerUserName',
|
||||
'signDate',
|
||||
'createTime'
|
||||
]
|
||||
})
|
||||
|
||||
// 查询参数
|
||||
const queryParams = ref<ContractQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
contractNo: undefined,
|
||||
contractName: undefined,
|
||||
customerName: undefined,
|
||||
@@ -1340,7 +1246,6 @@ watchDebounced(
|
||||
|
||||
onMounted(async () => {
|
||||
await loadPerms()
|
||||
initColumnSetting();
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
<!-- 合同模板管理 -->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 查询表单 -->
|
||||
<el-card shadow="hover" v-show="showSearch" class="mb-[10px]">
|
||||
<el-form :model="queryParams" ref="queryFormRef" label-width="90px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">合同模板</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form ref="queryFormRef" :model="queryParams" class="filter-form" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
<el-form-item label="模板名称" prop="templateName">
|
||||
<el-input v-model="queryParams.templateName" placeholder="请输入模板名称" clearable @keyup.enter="handleQuery" />
|
||||
<el-input
|
||||
v-model="queryParams.templateName"
|
||||
placeholder="模板名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<el-form-item label="模板类型" prop="templateType">
|
||||
<el-select v-model="queryParams.templateType" placeholder="请选择模板类型" clearable style="width: 100%">
|
||||
<el-select v-model="queryParams.templateType" placeholder="全部" clearable>
|
||||
<el-option
|
||||
v-for="dict in dictStore.getOptions('crm_contract_type')"
|
||||
:key="dict.value"
|
||||
@@ -20,99 +27,180 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<el-form-item label="状态" prop="isActive">
|
||||
<el-select v-model="queryParams.isActive" placeholder="请选择状态" clearable style="width: 100%">
|
||||
<el-select v-model="queryParams.isActive" placeholder="全部" clearable>
|
||||
<el-option label="启用" :value="1" />
|
||||
<el-option label="停用" :value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24" style="text-align: right">
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按模板名称、类型筛选。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" :loading="loading" @click="resetQuery">
|
||||
<el-icon><RefreshLeft /></el-icon>重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleQuery">
|
||||
<el-icon><Search /></el-icon>搜索
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col v-if="hasContractPerm('templateAdd')" :span="1.5">
|
||||
<el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col v-if="hasContractPerm('templateRemove')" :span="1.5">
|
||||
<el-button type="danger" icon="Delete" :disabled="multiple || !allRowsDeletableByCreator(templateList.filter((item) => ids.includes(item.id)))" :title="allRowsDeletableByCreator(templateList.filter((item) => ids.includes(item.id))) ? '' : CREATOR_DELETE_TIP" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col v-if="hasContractPerm('templateExport')" :span="1.5">
|
||||
<el-button type="success" icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<el-table v-loading="loading" :data="templateList" @selection-change="handleSelectionChange" border>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="模板名称" prop="templateName" :show-overflow-tooltip="true" min-width="200">
|
||||
<template #default="scope">
|
||||
<el-link type="primary" @click="handleView(scope.row)">{{ scope.row.templateName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="模板类型" align="center" prop="templateType" width="120">
|
||||
<template #default="scope">
|
||||
<DictTag dict-type="crm_contract_type" :value="scope.row.templateType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="模板编号" align="center" prop="templateNo" width="150" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="状态" align="center" prop="isActive" width="100">
|
||||
<template #default="scope">
|
||||
<el-switch
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
v-if="hasContractPerm('templateAdd')"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>新增模板
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('templateEdit')"
|
||||
v-model="scope.row.isActive"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
@change="handleStatusChange(scope.row)"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('templateRemove')"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="
|
||||
selectedRows.length === 0 ||
|
||||
!allRowsDeletableByCreator(selectedRows)
|
||||
"
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete()"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('templateExport')"
|
||||
class="btn-ghost"
|
||||
:loading="exportLoading"
|
||||
@click="handleExport"
|
||||
>
|
||||
<el-icon><Download /></el-icon>导出
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="getList" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
v-loading="loading"
|
||||
:data="templateList"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="templateName"
|
||||
label="模板名称"
|
||||
min-width="200"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.templateName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="模板类型" min-width="120" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="dictStore.getTagType('crm_contract_type', row.templateType)"
|
||||
size="small"
|
||||
>
|
||||
{{ dictStore.getLabel('crm_contract_type', row.templateType) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="templateNo"
|
||||
label="模板编号"
|
||||
min-width="150"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-tag v-else :type="scope.row.isActive === 1 ? 'success' : 'info'" size="small">
|
||||
{{ scope.row.isActive === 1 ? '启用' : '停用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="使用次数" align="center" prop="usageCount" width="100" />
|
||||
<el-table-column label="排序" align="center" prop="sort" width="80" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-tooltip v-if="hasContractPerm('templateEdit')" content="编辑" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" />
|
||||
</el-tooltip>
|
||||
<el-tooltip v-if="hasContractPerm('templateRemove') && canDeleteByCreator(scope.row)" content="删除" placement="top">
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-table-column label="状态" min-width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
v-if="hasContractPerm('templateEdit')"
|
||||
v-model="row.isActive"
|
||||
:active-value="1"
|
||||
:inactive-value="0"
|
||||
@change="handleStatusChange(row)"
|
||||
/>
|
||||
<el-tag v-else :type="row.isActive === 1 ? 'success' : 'info'" size="small">
|
||||
{{ row.isActive === 1 ? '启用' : '停用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="usageCount"
|
||||
label="使用次数"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column prop="sort" label="排序" min-width="80" align="center" header-align="center" />
|
||||
<el-table-column label="创建时间" min-width="160" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
{{ parseTime(row.createTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
v-model:current-page="queryParams.pageNum"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
@size-change="getList"
|
||||
@current-change="getList"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 添加或修改对话框 -->
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="900px" append-to-body>
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-dialog
|
||||
v-model="dialog.visible"
|
||||
:title="dialog.title"
|
||||
width="900px"
|
||||
class="dialog-form-layout order-module-dialog-mask"
|
||||
align-center
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
append-to-body
|
||||
@close="cancel"
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="top"
|
||||
scroll-to-error
|
||||
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
|
||||
>
|
||||
<div class="form-grid-2">
|
||||
<el-form-item label="模板名称" prop="templateName">
|
||||
<el-input v-model="form.templateName" placeholder="请输入模板名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="模板类型" prop="templateType">
|
||||
<el-select v-model="form.templateType" placeholder="请选择模板类型" style="width: 100%">
|
||||
<el-option
|
||||
@@ -123,63 +211,98 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="isActive">
|
||||
<el-radio-group v-model="form.isActive">
|
||||
<el-radio :value="1">启用</el-radio>
|
||||
<el-radio :value="0">停用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input-number v-model="form.sort" :min="0" :max="9999" controls-position="right" style="width: 100%" />
|
||||
<el-input-number
|
||||
v-model="form.sort"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="合同条款" prop="contractTerms">
|
||||
<el-input v-model="form.contractTerms" type="textarea" :rows="4" placeholder="请输入合同条款" />
|
||||
</el-form-item>
|
||||
<el-form-item label="付款条款" prop="paymentTerms">
|
||||
<el-input v-model="form.paymentTerms" type="textarea" :rows="3" placeholder="请输入付款条款" />
|
||||
</el-form-item>
|
||||
<el-form-item label="交付条款" prop="deliveryTerms">
|
||||
<el-input v-model="form.deliveryTerms" type="textarea" :rows="3" placeholder="请输入交付条款" />
|
||||
</el-form-item>
|
||||
<el-form-item label="模板内容" prop="templateContent">
|
||||
<el-input v-model="form.templateContent" type="textarea" :rows="6" placeholder="请输入模板内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="2" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-form-item label="合同条款" prop="contractTerms" class="form-col-span-2">
|
||||
<el-input v-model="form.contractTerms" type="textarea" :rows="4" placeholder="请输入合同条款" />
|
||||
</el-form-item>
|
||||
<el-form-item label="付款条款" prop="paymentTerms" class="form-col-span-2">
|
||||
<el-input v-model="form.paymentTerms" type="textarea" :rows="3" placeholder="请输入付款条款" />
|
||||
</el-form-item>
|
||||
<el-form-item label="交付条款" prop="deliveryTerms" class="form-col-span-2">
|
||||
<el-input v-model="form.deliveryTerms" type="textarea" :rows="3" placeholder="请输入交付条款" />
|
||||
</el-form-item>
|
||||
<el-form-item label="模板内容" prop="templateContent" class="form-col-span-2">
|
||||
<el-input v-model="form.templateContent" type="textarea" :rows="6" placeholder="请输入模板内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark" class="form-col-span-2">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="2" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button class="btn-ghost" @click="cancel">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" :loading="submitLoading" @click="submitForm">
|
||||
<el-icon><Check /></el-icon>确定
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 查看详情 -->
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewDialog.visible"
|
||||
:title="viewDialog.data.templateName || '模板详情'"
|
||||
:icon="Document"
|
||||
:code="viewDialog.data.templateNo"
|
||||
code-label="模板编号"
|
||||
:sections="templateViewSections"
|
||||
append-to-body
|
||||
/>
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewDialog.visible"
|
||||
:title="viewDialog.data.templateName || '模板详情'"
|
||||
:icon="Document"
|
||||
:code="viewDialog.data.templateNo"
|
||||
code-label="模板编号"
|
||||
:sections="templateViewSections"
|
||||
append-to-body
|
||||
>
|
||||
<template #hero-actions>
|
||||
<div class="template-view-hero-actions">
|
||||
<el-button
|
||||
v-if="hasContractPerm('templateEdit')"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleDetailEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasContractPerm('templateRemove')"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewDialog.data)"
|
||||
:title="canDeleteByCreator(viewDialog.data) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDetailDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ContractTemplate">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { Document } from '@element-plus/icons-vue'
|
||||
import {
|
||||
Document,
|
||||
Plus,
|
||||
Edit,
|
||||
Delete,
|
||||
Download,
|
||||
Search,
|
||||
RefreshLeft,
|
||||
Close,
|
||||
Check
|
||||
} from '@element-plus/icons-vue'
|
||||
import SystemViewDialog, {
|
||||
type ViewField,
|
||||
type ViewSection
|
||||
@@ -200,25 +323,27 @@ import {
|
||||
} from '@/api/crm/contract/template'
|
||||
import { parseTime } from '@/utils/format'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import DictTag from '@/components/DictTag/index.vue'
|
||||
import { $modal } from '@/utils/modal'
|
||||
import { useContractPerm } from '@/hooks/business/useContractPerm'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import {
|
||||
canDeleteByCreator,
|
||||
filterDeletableByCreator,
|
||||
allRowsDeletableByCreator,
|
||||
CREATOR_DELETE_TIP
|
||||
} from '@/utils/creator-delete'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const { loadPerms, hasContractPerm } = useContractPerm()
|
||||
|
||||
// 查询参数
|
||||
const queryParams = ref<TemplateQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
templateNo: undefined,
|
||||
templateName: undefined,
|
||||
templateType: undefined,
|
||||
isActive: undefined
|
||||
});
|
||||
})
|
||||
|
||||
// 表单数据
|
||||
const form = ref<TemplateForm>({
|
||||
templateName: '',
|
||||
templateType: '',
|
||||
@@ -229,35 +354,31 @@ const form = ref<TemplateForm>({
|
||||
isActive: 1,
|
||||
sort: 0,
|
||||
remark: ''
|
||||
});
|
||||
})
|
||||
|
||||
// 表单校验规则
|
||||
const rules = ref({
|
||||
templateName: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }],
|
||||
templateType: [{ required: true, message: '模板类型不能为空', trigger: 'change' }],
|
||||
templateContent: [{ required: true, message: '模板内容不能为空', trigger: 'blur' }]
|
||||
});
|
||||
})
|
||||
|
||||
// 数据列表
|
||||
const templateList = ref<TemplateVO[]>([]);
|
||||
const loading = ref(true);
|
||||
const total = ref(0);
|
||||
const showSearch = ref(false);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const ids = ref<number[]>([]);
|
||||
const templateList = ref<TemplateVO[]>([])
|
||||
const selectedRows = ref<TemplateVO[]>([])
|
||||
const loading = ref(true)
|
||||
const submitLoading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const total = ref(0)
|
||||
const ids = ref<number[]>([])
|
||||
|
||||
// 对话框
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
})
|
||||
|
||||
// 查看详情对话框
|
||||
const viewDialog = reactive({
|
||||
visible: false,
|
||||
data: {} as TemplateVO
|
||||
});
|
||||
})
|
||||
|
||||
const templateViewSections = computed<ViewSection[]>(() => {
|
||||
const d = viewDialog.data
|
||||
@@ -286,87 +407,99 @@ const templateViewSections = computed<ViewSection[]>(() => {
|
||||
return sections
|
||||
})
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const formRef = ref<ElFormInstance>();
|
||||
const queryFormRef = ref<ElFormInstance>()
|
||||
const formRef = ref<ElFormInstance>()
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await listTemplate(queryParams.value);
|
||||
templateList.value = res.rows;
|
||||
total.value = res.total;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请选择一条数据进行编辑')
|
||||
return
|
||||
}
|
||||
};
|
||||
handleUpdate(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDetailEdit() {
|
||||
if (!viewDialog.data?.id) return
|
||||
viewDialog.visible = false
|
||||
await handleUpdate(viewDialog.data as TemplateVO)
|
||||
}
|
||||
|
||||
async function handleDetailDelete() {
|
||||
if (!viewDialog.data?.id) return
|
||||
await handleDelete(viewDialog.data as TemplateVO)
|
||||
viewDialog.visible = false
|
||||
}
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await listTemplate(queryParams.value)
|
||||
templateList.value = res.rows
|
||||
total.value = res.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
queryFormRef.value?.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: TemplateVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length !== 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
selectedRows.value = selection
|
||||
ids.value = selection.map((item) => item.id)
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
reset();
|
||||
dialog.visible = true;
|
||||
dialog.title = '添加合同模板';
|
||||
};
|
||||
reset()
|
||||
dialog.visible = true
|
||||
dialog.title = '添加合同模板'
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row: TemplateVO) => {
|
||||
reset();
|
||||
const res = await getTemplate(row.id);
|
||||
Object.assign(form.value, res.data);
|
||||
dialog.visible = true;
|
||||
dialog.title = '修改合同模板';
|
||||
};
|
||||
reset()
|
||||
const res = await getTemplate(row.id)
|
||||
Object.assign(form.value, res.data)
|
||||
dialog.visible = true
|
||||
dialog.title = '修改合同模板'
|
||||
}
|
||||
|
||||
/** 查看详情 */
|
||||
const handleView = async (row: TemplateVO) => {
|
||||
const res = await getTemplate(row.id);
|
||||
viewDialog.data = res.data;
|
||||
viewDialog.visible = true;
|
||||
};
|
||||
const res = await getTemplate(row.id)
|
||||
viewDialog.data = res.data
|
||||
viewDialog.visible = true
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid) => {
|
||||
if (valid) {
|
||||
try {
|
||||
if (form.value.id) {
|
||||
await updateTemplate(form.value);
|
||||
$modal.msgSuccess('修改成功')
|
||||
} else {
|
||||
await addTemplate(form.value)
|
||||
$modal.msgSuccess('新增成功')
|
||||
}
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
if (!valid) return
|
||||
submitLoading.value = true
|
||||
try {
|
||||
if (form.value.id) {
|
||||
await updateTemplate(form.value)
|
||||
$modal.msgSuccess('修改成功')
|
||||
} else {
|
||||
await addTemplate(form.value)
|
||||
$modal.msgSuccess('新增成功')
|
||||
}
|
||||
dialog.visible = false
|
||||
await getList()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
submitLoading.value = false
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: TemplateVO) => {
|
||||
const targets = row ? [row] : templateList.value.filter((item) => ids.value.includes(item.id))
|
||||
const targets = row ? [row] : selectedRows.value
|
||||
const deletable = filterDeletableByCreator(targets)
|
||||
if (!deletable.length) {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
@@ -376,17 +509,16 @@ const handleDelete = async (row?: TemplateVO) => {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
const idList = row?.id ? [row.id] : ids.value;
|
||||
const idList = row?.id ? [row.id] : ids.value
|
||||
await $modal.confirm('是否确认删除选中的合同模板?')
|
||||
await delTemplate(idList)
|
||||
$modal.msgSuccess('删除成功')
|
||||
await getList();
|
||||
};
|
||||
await getList()
|
||||
}
|
||||
|
||||
/** 状态切换 */
|
||||
const handleStatusChange = async (row: TemplateVO) => {
|
||||
try {
|
||||
const text = row.isActive === 1 ? '启用' : '停用';
|
||||
const text = row.isActive === 1 ? '启用' : '停用'
|
||||
await $modal.confirm(`确认要${text}"${row.templateName}"吗?`)
|
||||
if (row.isActive === 1) {
|
||||
await enableTemplate(row.id)
|
||||
@@ -394,14 +526,14 @@ const handleStatusChange = async (row: TemplateVO) => {
|
||||
await disableTemplate(row.id)
|
||||
}
|
||||
$modal.msgSuccess(`${text}成功`)
|
||||
await getList();
|
||||
await getList()
|
||||
} catch {
|
||||
row.isActive = row.isActive === 0 ? 1 : 0;
|
||||
row.isActive = row.isActive === 0 ? 1 : 0
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
exportLoading.value = true
|
||||
try {
|
||||
const res = await exportTemplate(queryParams.value)
|
||||
const blob =
|
||||
@@ -419,16 +551,16 @@ const handleExport = async () => {
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
$modal.msgError('导出失败')
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
dialog.visible = false;
|
||||
reset();
|
||||
};
|
||||
dialog.visible = false
|
||||
reset()
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = {
|
||||
id: undefined,
|
||||
@@ -441,19 +573,12 @@ const reset = () => {
|
||||
isActive: 1,
|
||||
sort: 0,
|
||||
remark: ''
|
||||
};
|
||||
formRef.value?.resetFields();
|
||||
};
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadPerms()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.text-content {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
@@ -235,7 +235,13 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleViewOpportunity(row.id)">
|
||||
{{ row.opportunityName }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商机阶段" min-width="120" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
@@ -267,20 +273,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
fixed="right"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
class-name="col-actions"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleViewOpportunity(row.id)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -310,7 +302,13 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleViewContract(row.id)">
|
||||
{{ row.contractName }}
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="合同类型" min-width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
@@ -348,20 +346,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
fixed="right"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
class-name="col-actions"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleViewContract(row.id)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -523,7 +507,7 @@ const followTotal = ref(0)
|
||||
const followQuery = ref<CustomerFollowQuery>({
|
||||
customerId: undefined,
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
pageSize: 20
|
||||
})
|
||||
|
||||
const contactList = ref<ContactVO[]>([])
|
||||
@@ -536,7 +520,7 @@ const operLogList = ref<OperLogVO[]>([])
|
||||
const operLogListFull = ref<OperLogVO[]>([])
|
||||
const logTotal = ref(0)
|
||||
const logLoading = ref(false)
|
||||
const logQuery = ref({ pageNum: 1, pageSize: 10 })
|
||||
const logQuery = ref({ pageNum: 1, pageSize: 20 })
|
||||
const activeTab = ref('follow')
|
||||
|
||||
const customerFormRef = ref<InstanceType<typeof CustomerForm>>()
|
||||
@@ -910,8 +894,8 @@ function open(id: number | string) {
|
||||
operLogList.value = []
|
||||
operLogListFull.value = []
|
||||
activeTab.value = 'follow'
|
||||
followQuery.value = { customerId: id, pageNum: 1, pageSize: 10 }
|
||||
logQuery.value = { pageNum: 1, pageSize: 10 }
|
||||
followQuery.value = { customerId: id, pageNum: 1, pageSize: 20 }
|
||||
logQuery.value = { pageNum: 1, pageSize: 20 }
|
||||
getCustomerInfo()
|
||||
getFollowList()
|
||||
}
|
||||
|
||||
@@ -3,17 +3,19 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>客户列表</h2>
|
||||
<h2 class="title-bar-heading">客户列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-tabs">
|
||||
<el-tabs v-model="activeView" @tab-change="handleViewChange">
|
||||
<el-tab-pane label="我的客户" name="mine" />
|
||||
<el-tab-pane label="全部客户" name="all" />
|
||||
<el-tab-pane label="待跟进" name="toFollow" />
|
||||
<el-tab-pane label="重点客户" name="key" />
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-tabs
|
||||
v-model="activeView"
|
||||
class="panel-pill-tabs panel-pill-tabs--lg"
|
||||
@tab-change="handleViewChange"
|
||||
>
|
||||
<el-tab-pane label="我的客户" name="mine" />
|
||||
<el-tab-pane label="全部客户" name="all" />
|
||||
<el-tab-pane label="待跟进" name="toFollow" />
|
||||
<el-tab-pane label="重点客户" name="key" />
|
||||
</el-tabs>
|
||||
|
||||
<!-- 筛选区 -->
|
||||
<div class="filter-block">
|
||||
@@ -162,10 +164,38 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增客户
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length === 0 || !allRowsDeletableByCreator(selectedRows)"
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete()"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :disabled="multiple" @click="handleIntoPool()">
|
||||
<el-icon><DocumentCopy /></el-icon>
|
||||
放入公海
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="getList"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -178,6 +208,7 @@
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
@@ -591,33 +622,6 @@
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="320"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
class-name="col-actions"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div class="col-actions-inner">
|
||||
<el-button class="btn-op-item" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item btn-op-danger"
|
||||
:disabled="!canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
@@ -649,46 +653,6 @@
|
||||
|
||||
<!-- 客户成交对话框 -->
|
||||
<deal-form ref="dealFormRef" @success="getList" />
|
||||
|
||||
<!-- 列设置对话框 -->
|
||||
<el-dialog
|
||||
v-model="columnSettingDialog.visible"
|
||||
title="列设置"
|
||||
width="600px"
|
||||
class="dialog-form-layout"
|
||||
align-center
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div class="column-setting-content">
|
||||
<el-checkbox
|
||||
v-model="checkAll"
|
||||
:indeterminate="isIndeterminate"
|
||||
@change="handleCheckAllChange"
|
||||
>
|
||||
全选
|
||||
</el-checkbox>
|
||||
<el-divider />
|
||||
<el-checkbox-group v-model="visibleColumns" @change="handleCheckedColumnsChange">
|
||||
<div v-for="col in tableColumns" :key="col.prop" class="column-item">
|
||||
<el-checkbox :label="col.prop" :disabled="col.fixed">{{ col.label }}</el-checkbox>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button class="btn-ghost" @click="columnSettingDialog.visible = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleResetColumns">
|
||||
<el-icon><RefreshLeft /></el-icon>恢复默认
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" @click="handleSaveColumnSetting">
|
||||
<el-icon><Check /></el-icon>保存
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
@@ -697,18 +661,20 @@
|
||||
import {
|
||||
Plus,
|
||||
Delete,
|
||||
Close,
|
||||
Check,
|
||||
Search,
|
||||
RefreshLeft,
|
||||
View,
|
||||
DocumentCopy,
|
||||
ArrowUpBold,
|
||||
ArrowDownBold,
|
||||
Edit,
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import {
|
||||
canDeleteByCreator,
|
||||
filterDeletableByCreator,
|
||||
allRowsDeletableByCreator,
|
||||
CREATOR_DELETE_TIP
|
||||
} from '@/utils/creator-delete'
|
||||
import {
|
||||
fetchCustomerList,
|
||||
fetchCustomerDetail,
|
||||
@@ -729,6 +695,8 @@ import TransferForm from './TransferDialog.vue'
|
||||
import IntoPoolForm from './IntoPoolDialog.vue'
|
||||
import FollowForm from './FollowFormDialog.vue'
|
||||
import DealForm from './DealDialog.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
|
||||
@@ -755,75 +723,76 @@ const activeView = ref('mine')
|
||||
const customerList = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const selectedRows = ref<any[]>([])
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
// 多选状态
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const ids = ref<(number | string)[]>([])
|
||||
|
||||
// 列配置相关
|
||||
const COLUMN_STORAGE_KEY = 'crm_customer_visible_columns'
|
||||
|
||||
const tableColumns = ref([
|
||||
{ prop: 'shortName', label: '客户简称', fixed: false },
|
||||
{ prop: 'customerType', label: '客户类型', fixed: false },
|
||||
{ prop: 'mobile', label: '手机号', fixed: false },
|
||||
{ prop: 'telephone', label: '固定电话', fixed: false },
|
||||
{ prop: 'email', label: '邮箱', fixed: false },
|
||||
{ prop: 'website', label: '客户网站', fixed: false },
|
||||
{ prop: 'level', label: '客户级别', fixed: false },
|
||||
{ prop: 'source', label: '客户来源', fixed: false },
|
||||
{ prop: 'industry', label: '所属行业', fixed: false },
|
||||
{ prop: 'parkArea', label: '所在园区', fixed: false },
|
||||
{ prop: 'scale', label: '企业规模', fixed: false },
|
||||
{ prop: 'province', label: '省', fixed: false },
|
||||
{ prop: 'city', label: '市', fixed: false },
|
||||
{ prop: 'district', label: '区', fixed: false },
|
||||
{ prop: 'address', label: '详细地址', fixed: false },
|
||||
{ prop: 'status', label: '客户状态', fixed: false },
|
||||
{ prop: 'dealStatus', label: '成交状态', fixed: false },
|
||||
{ prop: 'ownerUserName', label: '负责人', fixed: false },
|
||||
{ prop: 'followCount', label: '跟进次数', fixed: false },
|
||||
{ prop: 'lastTime', label: '最后跟进时间', fixed: false },
|
||||
{ prop: 'nextTime', label: '下次联系时间', fixed: false },
|
||||
{ prop: 'dealTime', label: '成交时间', fixed: false },
|
||||
{ prop: 'dealAmount', label: '成交金额', fixed: false },
|
||||
{ prop: 'contactCount', label: '联系人数量', fixed: false },
|
||||
{ prop: 'opportunityCount', label: '商机数量', fixed: false },
|
||||
{ prop: 'contractCount', label: '合同数量', fixed: false },
|
||||
{ prop: 'intoPoolTime', label: '进入公海时间', fixed: false },
|
||||
{ prop: 'claimTime', label: '领取时间', fixed: false },
|
||||
{ prop: 'protectTime', label: '保护到期时间', fixed: false },
|
||||
{ prop: 'createDeptName', label: '创建部门', fixed: false },
|
||||
{ prop: 'createByName', label: '创建人', fixed: false },
|
||||
{ prop: 'createTime', label: '创建时间', fixed: false },
|
||||
{ prop: 'updateByName', label: '更新人', fixed: false },
|
||||
{ prop: 'updateTime', label: '更新时间', fixed: false },
|
||||
{ prop: 'remark', label: '备注', fixed: false },
|
||||
])
|
||||
|
||||
const defaultVisibleColumns = [
|
||||
'customerType',
|
||||
'mobile',
|
||||
'level',
|
||||
'source',
|
||||
'industry',
|
||||
'parkArea',
|
||||
'status',
|
||||
'dealStatus',
|
||||
'ownerUserName',
|
||||
'followCount',
|
||||
'dealAmount',
|
||||
'lastTime',
|
||||
'nextTime',
|
||||
'createTime',
|
||||
// 列配置
|
||||
const listColumnDefs = [
|
||||
{ prop: 'shortName', label: '客户简称' },
|
||||
{ prop: 'customerType', label: '客户类型' },
|
||||
{ prop: 'mobile', label: '手机号' },
|
||||
{ prop: 'telephone', label: '固定电话' },
|
||||
{ prop: 'email', label: '邮箱' },
|
||||
{ prop: 'website', label: '客户网站' },
|
||||
{ prop: 'level', label: '客户级别' },
|
||||
{ prop: 'source', label: '客户来源' },
|
||||
{ prop: 'industry', label: '所属行业' },
|
||||
{ prop: 'parkArea', label: '所在园区' },
|
||||
{ prop: 'scale', label: '企业规模' },
|
||||
{ prop: 'province', label: '省' },
|
||||
{ prop: 'city', label: '市' },
|
||||
{ prop: 'district', label: '区' },
|
||||
{ prop: 'address', label: '详细地址' },
|
||||
{ prop: 'status', label: '客户状态' },
|
||||
{ prop: 'dealStatus', label: '成交状态' },
|
||||
{ prop: 'ownerUserName', label: '负责人' },
|
||||
{ prop: 'followCount', label: '跟进次数' },
|
||||
{ prop: 'lastTime', label: '最后跟进时间' },
|
||||
{ prop: 'nextTime', label: '下次联系时间' },
|
||||
{ prop: 'dealTime', label: '成交时间' },
|
||||
{ prop: 'dealAmount', label: '成交金额' },
|
||||
{ prop: 'contactCount', label: '联系人数量' },
|
||||
{ prop: 'opportunityCount', label: '商机数量' },
|
||||
{ prop: 'contractCount', label: '合同数量' },
|
||||
{ prop: 'intoPoolTime', label: '进入公海时间' },
|
||||
{ prop: 'claimTime', label: '领取时间' },
|
||||
{ prop: 'protectTime', label: '保护到期时间' },
|
||||
{ prop: 'createDeptName', label: '创建部门' },
|
||||
{ prop: 'createByName', label: '创建人' },
|
||||
{ prop: 'createTime', label: '创建时间' },
|
||||
{ prop: 'updateByName', label: '更新人' },
|
||||
{ prop: 'updateTime', label: '更新时间' },
|
||||
{ prop: 'remark', label: '备注' },
|
||||
]
|
||||
|
||||
const visibleColumns = ref<string[]>([])
|
||||
const columnSettingDialog = reactive({ visible: false })
|
||||
const checkAll = ref(false)
|
||||
const isIndeterminate = ref(false)
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('crm_customer_visible_columns', listColumnDefs, {
|
||||
defaultVisibleProps: [
|
||||
'customerType',
|
||||
'mobile',
|
||||
'level',
|
||||
'source',
|
||||
'industry',
|
||||
'parkArea',
|
||||
'status',
|
||||
'dealStatus',
|
||||
'ownerUserName',
|
||||
'followCount',
|
||||
'dealAmount',
|
||||
'lastTime',
|
||||
'nextTime',
|
||||
'createTime',
|
||||
]
|
||||
})
|
||||
|
||||
// 子组件引用
|
||||
const customerFormRef = ref<InstanceType<typeof CustomerForm>>()
|
||||
@@ -905,6 +874,14 @@ function handleViewChange() {
|
||||
getList()
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条数据进行编辑')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
/** 编辑客户 */
|
||||
function handleEdit(row: any) {
|
||||
customerFormRef.value?.open(row.id)
|
||||
@@ -976,8 +953,7 @@ function handleDeal(row?: any) {
|
||||
|
||||
/** 更多操作命令 */
|
||||
function handleMoreCommand(cmd: string, row: any) {
|
||||
if (cmd === 'view') handleView(row)
|
||||
else if (cmd === 'edit') handleEdit(row)
|
||||
if (cmd === 'edit') handleEdit(row)
|
||||
else if (cmd === 'transfer') handleTransfer(row)
|
||||
else if (cmd === 'intoPool') handleIntoPool(row)
|
||||
else if (cmd === 'delete') handleDelete(row)
|
||||
@@ -1029,61 +1005,6 @@ async function handleExport() {
|
||||
}
|
||||
}
|
||||
|
||||
// ── 列设置 ──
|
||||
|
||||
function initColumnSetting() {
|
||||
const savedColumns = localStorage.getItem(COLUMN_STORAGE_KEY)
|
||||
if (savedColumns) {
|
||||
try {
|
||||
visibleColumns.value = JSON.parse(savedColumns)
|
||||
} catch {
|
||||
visibleColumns.value = [...defaultVisibleColumns]
|
||||
}
|
||||
} else {
|
||||
visibleColumns.value = [...defaultVisibleColumns]
|
||||
}
|
||||
updateCheckAllStatus()
|
||||
}
|
||||
|
||||
function isColumnVisible(prop: string) {
|
||||
return visibleColumns.value.includes(prop)
|
||||
}
|
||||
|
||||
function handleColumnSetting() {
|
||||
columnSettingDialog.visible = true
|
||||
}
|
||||
|
||||
function handleCheckAllChange(val: boolean) {
|
||||
visibleColumns.value = val ? tableColumns.value.map((col) => col.prop) : []
|
||||
isIndeterminate.value = false
|
||||
}
|
||||
|
||||
function handleCheckedColumnsChange() {
|
||||
updateCheckAllStatus()
|
||||
}
|
||||
|
||||
function updateCheckAllStatus() {
|
||||
const checkedCount = visibleColumns.value.length
|
||||
const totalCount = tableColumns.value.length
|
||||
checkAll.value = checkedCount === totalCount
|
||||
isIndeterminate.value = checkedCount > 0 && checkedCount < totalCount
|
||||
}
|
||||
|
||||
function handleResetColumns() {
|
||||
visibleColumns.value = [...defaultVisibleColumns]
|
||||
updateCheckAllStatus()
|
||||
}
|
||||
|
||||
function handleSaveColumnSetting() {
|
||||
try {
|
||||
localStorage.setItem(COLUMN_STORAGE_KEY, JSON.stringify(visibleColumns.value))
|
||||
ElMessage.success('列设置保存成功')
|
||||
columnSettingDialog.visible = false
|
||||
} catch {
|
||||
ElMessage.error('保存列设置失败')
|
||||
}
|
||||
}
|
||||
|
||||
watchDebounced(
|
||||
() => ({ ...searchForm, dateRange: dateRange.value }),
|
||||
() => {
|
||||
@@ -1094,7 +1015,6 @@ watchDebounced(
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
initColumnSetting()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
@@ -1111,24 +1031,6 @@ onMounted(() => {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.column-setting-content {
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
|
||||
.column-item {
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
:deep(.el-checkbox) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.col-actions-inner {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>公海池规则</h2>
|
||||
<h2 class="title-bar-heading">公海池规则</h2>
|
||||
</div>
|
||||
|
||||
<!-- 筛选区 -->
|
||||
@@ -34,10 +34,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按规则名称模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset">
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset">
|
||||
<el-icon><RefreshLeft /></el-icon>重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch">
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch">
|
||||
<el-icon><Search /></el-icon>搜索
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -56,6 +56,36 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增规则
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
v-auth="'edit'"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
v-auth="'edit'"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarToggle"
|
||||
>
|
||||
<el-icon>
|
||||
<CircleClose v-if="selectedRows[0]?.status === 'enable'" />
|
||||
<CircleCheck v-else />
|
||||
</el-icon>
|
||||
{{ selectedRows[0]?.status === 'enable' ? '禁用' : '启用' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
v-auth="'delete'"
|
||||
:disabled="selectedRows.length === 0 || !allRowsDeletableByCreator(selectedRows)"
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete()"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="warning"
|
||||
@@ -65,6 +95,8 @@
|
||||
<el-icon><VideoPlay /></el-icon>
|
||||
手动执行
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="getList" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -150,41 +182,6 @@
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="200"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button class="btn-op-item primary" v-auth="'edit'" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item"
|
||||
:class="row.status === 'enable' ? 'warning' : 'success'"
|
||||
v-auth="'edit'"
|
||||
@click="handleToggle(row)"
|
||||
>
|
||||
<el-icon>
|
||||
<CircleClose v-if="row.status === 'enable'" />
|
||||
<CircleCheck v-else />
|
||||
</el-icon>
|
||||
{{ row.status === 'enable' ? '禁用' : '启用' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item danger"
|
||||
v-auth="'delete'"
|
||||
v-if="canDeleteByCreator(row)"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
@@ -206,6 +203,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import {
|
||||
Plus,
|
||||
Close,
|
||||
@@ -238,7 +236,7 @@ const searchForm = reactive({
|
||||
const ruleList = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const selectedRows = ref<any[]>([])
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
const ruleDialogRef = ref()
|
||||
|
||||
@@ -296,6 +294,22 @@ const handleAdd = () => {
|
||||
ruleDialogRef.value?.open()
|
||||
}
|
||||
|
||||
const handleToolbarEdit = () => {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条数据进行编辑')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
const handleToolbarToggle = () => {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条数据进行操作')
|
||||
return
|
||||
}
|
||||
handleToggle(selectedRows.value[0])
|
||||
}
|
||||
|
||||
const handleEdit = (row: any) => {
|
||||
ruleDialogRef.value?.open(row)
|
||||
}
|
||||
@@ -315,12 +329,30 @@ const handleToggle = async (row: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const handleDelete = async (row: any) => {
|
||||
const handleDelete = async (row?: any) => {
|
||||
const targets = row ? [row] : selectedRows.value
|
||||
if (!targets.length) {
|
||||
ElMessage.warning('请至少选择一条数据进行删除')
|
||||
return
|
||||
}
|
||||
const deletable = filterDeletableByCreator(targets)
|
||||
if (!deletable.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
if (deletable.length < targets.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(`确认删除规则「${row.poolName}」吗?`, '提示', {
|
||||
const label =
|
||||
deletable.length === 1 ? `规则「${deletable[0].poolName}」` : `选中的 ${deletable.length} 条规则`
|
||||
await ElMessageBox.confirm(`确认删除${label}吗?`, '提示', {
|
||||
type: 'warning',
|
||||
})
|
||||
await fetchDeletePoolRule({ id: row.id })
|
||||
for (const item of deletable) {
|
||||
await fetchDeletePoolRule({ id: item.id })
|
||||
}
|
||||
ElMessage.success('删除成功')
|
||||
getList()
|
||||
} catch {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>公海池</h2>
|
||||
<h2 class="title-bar-heading">公海池</h2>
|
||||
</div>
|
||||
|
||||
<!-- 统计信息 -->
|
||||
@@ -60,10 +60,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按客户名称、编号模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset">
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset">
|
||||
<el-icon><RefreshLeft /></el-icon>重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch">
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch">
|
||||
<el-icon><Search /></el-icon>搜索
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -91,10 +91,16 @@
|
||||
<el-icon><User /></el-icon>
|
||||
分配客户
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleColumnSetting">
|
||||
<el-icon><Setting /></el-icon>
|
||||
列设置
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="getList"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -107,6 +113,7 @@
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
@@ -501,36 +508,6 @@
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="200"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button class="btn-op-item primary" @click="handleClaim(row)">
|
||||
<el-icon><Select /></el-icon>领取
|
||||
</el-button>
|
||||
<el-dropdown trigger="hover" @command="(cmd: string) => handleMoreCommand(cmd, row)">
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="view">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="assign">
|
||||
<el-icon><User /></el-icon>分配
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
@@ -553,64 +530,22 @@
|
||||
|
||||
<!-- 分配客户对话框 -->
|
||||
<assign-dialog ref="assignDialogRef" @success="getList" />
|
||||
|
||||
<!-- 列设置对话框 -->
|
||||
<el-dialog
|
||||
v-model="columnSettingDialog.visible"
|
||||
title="列设置"
|
||||
width="600px"
|
||||
class="dialog-form-layout"
|
||||
align-center
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div class="column-setting-content">
|
||||
<el-checkbox
|
||||
v-model="checkAll"
|
||||
:indeterminate="isIndeterminate"
|
||||
@change="handleCheckAllChange"
|
||||
>
|
||||
全选
|
||||
</el-checkbox>
|
||||
<el-divider />
|
||||
<el-checkbox-group v-model="visibleColumns" @change="handleCheckedColumnsChange">
|
||||
<div v-for="col in tableColumns" :key="col.prop" class="column-item">
|
||||
<el-checkbox :label="col.prop" :disabled="col.fixed">{{ col.label }}</el-checkbox>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button class="btn-ghost" @click="columnSettingDialog.visible = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleResetColumns">
|
||||
<el-icon><RefreshLeft /></el-icon>恢复默认
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" @click="handleSaveColumnSetting">
|
||||
<el-icon><Check /></el-icon>保存
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
Close,
|
||||
Check,
|
||||
Search,
|
||||
RefreshLeft,
|
||||
Select,
|
||||
User,
|
||||
Setting,
|
||||
More,
|
||||
View,
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { fetchPoolCustomerList } from '@/api/crm/pool'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import ClaimDialog from './components/ClaimDialog.vue'
|
||||
import AssignDialog from './components/AssignDialog.vue'
|
||||
import CustomerDetail from '../CustomerDetailDialog.vue'
|
||||
@@ -628,7 +563,7 @@ const searchForm = reactive({
|
||||
const customerList = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const selectedRows = ref<any[]>([])
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
// 多选状态
|
||||
const single = ref(true)
|
||||
@@ -644,113 +579,67 @@ const poolStatistics = reactive({
|
||||
})
|
||||
|
||||
// 列配置
|
||||
const COLUMN_STORAGE_KEY = 'crm_pool_visible_columns'
|
||||
|
||||
const tableColumns = ref([
|
||||
{ prop: 'shortName', label: '客户简称', fixed: false },
|
||||
{ prop: 'customerType', label: '客户类型', fixed: false },
|
||||
{ prop: 'mobile', label: '手机号', fixed: false },
|
||||
{ prop: 'telephone', label: '固定电话', fixed: false },
|
||||
{ prop: 'email', label: '邮箱', fixed: false },
|
||||
{ prop: 'website', label: '客户网站', fixed: false },
|
||||
{ prop: 'level', label: '客户级别', fixed: false },
|
||||
{ prop: 'source', label: '客户来源', fixed: false },
|
||||
{ prop: 'industry', label: '所属行业', fixed: false },
|
||||
{ prop: 'parkArea', label: '所在园区', fixed: false },
|
||||
{ prop: 'scale', label: '企业规模', fixed: false },
|
||||
{ prop: 'province', label: '省', fixed: false },
|
||||
{ prop: 'city', label: '市', fixed: false },
|
||||
{ prop: 'district', label: '区', fixed: false },
|
||||
{ prop: 'address', label: '详细地址', fixed: false },
|
||||
{ prop: 'status', label: '客户状态', fixed: false },
|
||||
{ prop: 'dealStatus', label: '成交状态', fixed: false },
|
||||
{ prop: 'ownerUserName', label: '原负责人', fixed: false },
|
||||
{ prop: 'followCount', label: '跟进次数', fixed: false },
|
||||
{ prop: 'lastTime', label: '最后跟进时间', fixed: false },
|
||||
{ prop: 'nextTime', label: '下次联系时间', fixed: false },
|
||||
{ prop: 'dealTime', label: '成交时间', fixed: false },
|
||||
{ prop: 'dealAmount', label: '成交金额', fixed: false },
|
||||
{ prop: 'contactCount', label: '联系人数量', fixed: false },
|
||||
{ prop: 'opportunityCount', label: '商机数量', fixed: false },
|
||||
{ prop: 'contractCount', label: '合同数量', fixed: false },
|
||||
{ prop: 'intoPoolTime', label: '进入公海时间', fixed: false },
|
||||
{ prop: 'claimTime', label: '领取时间', fixed: false },
|
||||
{ prop: 'protectTime', label: '保护到期时间', fixed: false },
|
||||
{ prop: 'createDeptName', label: '创建部门', fixed: false },
|
||||
{ prop: 'createByName', label: '创建人', fixed: false },
|
||||
{ prop: 'createTime', label: '创建时间', fixed: false },
|
||||
{ prop: 'updateByName', label: '更新人', fixed: false },
|
||||
{ prop: 'updateTime', label: '更新时间', fixed: false },
|
||||
{ prop: 'remark', label: '备注', fixed: false },
|
||||
])
|
||||
|
||||
const defaultVisibleColumns = [
|
||||
'customerType',
|
||||
'mobile',
|
||||
'level',
|
||||
'industry',
|
||||
'followCount',
|
||||
'lastTime',
|
||||
'intoPoolTime',
|
||||
'ownerUserName',
|
||||
const listColumnDefs = [
|
||||
{ prop: 'shortName', label: '客户简称' },
|
||||
{ prop: 'customerType', label: '客户类型' },
|
||||
{ prop: 'mobile', label: '手机号' },
|
||||
{ prop: 'telephone', label: '固定电话' },
|
||||
{ prop: 'email', label: '邮箱' },
|
||||
{ prop: 'website', label: '客户网站' },
|
||||
{ prop: 'level', label: '客户级别' },
|
||||
{ prop: 'source', label: '客户来源' },
|
||||
{ prop: 'industry', label: '所属行业' },
|
||||
{ prop: 'parkArea', label: '所在园区' },
|
||||
{ prop: 'scale', label: '企业规模' },
|
||||
{ prop: 'province', label: '省' },
|
||||
{ prop: 'city', label: '市' },
|
||||
{ prop: 'district', label: '区' },
|
||||
{ prop: 'address', label: '详细地址' },
|
||||
{ prop: 'status', label: '客户状态' },
|
||||
{ prop: 'dealStatus', label: '成交状态' },
|
||||
{ prop: 'ownerUserName', label: '原负责人' },
|
||||
{ prop: 'followCount', label: '跟进次数' },
|
||||
{ prop: 'lastTime', label: '最后跟进时间' },
|
||||
{ prop: 'nextTime', label: '下次联系时间' },
|
||||
{ prop: 'dealTime', label: '成交时间' },
|
||||
{ prop: 'dealAmount', label: '成交金额' },
|
||||
{ prop: 'contactCount', label: '联系人数量' },
|
||||
{ prop: 'opportunityCount', label: '商机数量' },
|
||||
{ prop: 'contractCount', label: '合同数量' },
|
||||
{ prop: 'intoPoolTime', label: '进入公海时间' },
|
||||
{ prop: 'claimTime', label: '领取时间' },
|
||||
{ prop: 'protectTime', label: '保护到期时间' },
|
||||
{ prop: 'createDeptName', label: '创建部门' },
|
||||
{ prop: 'createByName', label: '创建人' },
|
||||
{ prop: 'createTime', label: '创建时间' },
|
||||
{ prop: 'updateByName', label: '更新人' },
|
||||
{ prop: 'updateTime', label: '更新时间' },
|
||||
{ prop: 'remark', label: '备注' },
|
||||
]
|
||||
|
||||
const visibleColumns = ref<string[]>([])
|
||||
const columnSettingDialog = reactive({ visible: false })
|
||||
const checkAll = ref(false)
|
||||
const isIndeterminate = ref(false)
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('crm_pool_visible_columns', listColumnDefs, {
|
||||
defaultVisibleProps: [
|
||||
'customerType',
|
||||
'mobile',
|
||||
'level',
|
||||
'industry',
|
||||
'followCount',
|
||||
'lastTime',
|
||||
'intoPoolTime',
|
||||
'ownerUserName',
|
||||
]
|
||||
})
|
||||
|
||||
const claimDialogRef = ref()
|
||||
const assignDialogRef = ref()
|
||||
const customerDetailRef = ref()
|
||||
|
||||
const initColumnSetting = () => {
|
||||
const saved = localStorage.getItem(COLUMN_STORAGE_KEY)
|
||||
if (saved) {
|
||||
try {
|
||||
visibleColumns.value = JSON.parse(saved)
|
||||
} catch {
|
||||
visibleColumns.value = [...defaultVisibleColumns]
|
||||
}
|
||||
} else {
|
||||
visibleColumns.value = [...defaultVisibleColumns]
|
||||
}
|
||||
updateCheckAllStatus()
|
||||
}
|
||||
|
||||
const isColumnVisible = (prop: string) => visibleColumns.value.includes(prop)
|
||||
|
||||
const handleColumnSetting = () => {
|
||||
columnSettingDialog.visible = true
|
||||
}
|
||||
|
||||
const handleCheckAllChange = (val: boolean) => {
|
||||
visibleColumns.value = val ? tableColumns.value.map((col) => col.prop) : []
|
||||
isIndeterminate.value = false
|
||||
}
|
||||
|
||||
const handleCheckedColumnsChange = () => {
|
||||
updateCheckAllStatus()
|
||||
}
|
||||
|
||||
const updateCheckAllStatus = () => {
|
||||
const checkedCount = visibleColumns.value.length
|
||||
const totalCount = tableColumns.value.length
|
||||
checkAll.value = checkedCount === totalCount
|
||||
isIndeterminate.value = checkedCount > 0 && checkedCount < totalCount
|
||||
}
|
||||
|
||||
const handleResetColumns = () => {
|
||||
visibleColumns.value = [...defaultVisibleColumns]
|
||||
updateCheckAllStatus()
|
||||
}
|
||||
|
||||
const handleSaveColumnSetting = () => {
|
||||
localStorage.setItem(COLUMN_STORAGE_KEY, JSON.stringify(visibleColumns.value))
|
||||
ElMessage.success('列设置保存成功')
|
||||
columnSettingDialog.visible = false
|
||||
}
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -826,9 +715,7 @@ const handleAssign = (row?: any) => {
|
||||
}
|
||||
|
||||
const handleMoreCommand = (cmd: string, row: any) => {
|
||||
if (cmd === 'view') {
|
||||
handleView(row)
|
||||
} else if (cmd === 'assign') {
|
||||
if (cmd === 'assign') {
|
||||
handleAssign(row)
|
||||
}
|
||||
}
|
||||
@@ -843,7 +730,6 @@ watchDebounced(
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
initColumnSetting()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
@@ -877,22 +763,4 @@ onMounted(() => {
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.column-setting-content {
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
|
||||
.column-item {
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
:deep(.el-checkbox) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,18 +1,18 @@
|
||||
<template>
|
||||
<div class="app-container opportunity-funnel">
|
||||
<!-- 筛选条件 -->
|
||||
<el-card shadow="never" class="filter-card">
|
||||
<el-form :model="queryParams" ref="queryFormRef" label-width="90px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<div class="page-container opportunity-funnel-page">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">销售漏斗</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form ref="queryFormRef" class="filter-form" :model="queryParams" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
<el-form-item label="负责人" prop="ownerUserId">
|
||||
<el-select v-model="queryParams.ownerUserId" placeholder="请选择负责人" clearable style="width: 100%">
|
||||
<!-- TODO: 从用户列表获取 -->
|
||||
<el-select v-model="queryParams.ownerUserId" placeholder="请选择负责人" clearable>
|
||||
<el-option label="全部" :value="undefined" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="8" :lg="12" :md="16" :sm="24" :xs="24">
|
||||
<el-form-item label="时间范围" prop="timeRange">
|
||||
<el-date-picker
|
||||
v-model="queryParams.timeRange"
|
||||
@@ -24,198 +24,185 @@
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24" style="text-align: right">
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 概览统计 -->
|
||||
<el-row :gutter="16" class="summary-row">
|
||||
<el-col :span="6">
|
||||
<el-card shadow="hover" class="summary-card">
|
||||
<div class="card-icon" style="background: #e6f7ff">
|
||||
<el-icon :size="32" color="#1890ff"><Opportunity /></el-icon>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="card-value">{{ summary.totalOpportunities }}</div>
|
||||
<div class="card-label">商机总数</div>
|
||||
<div class="filter-actions">
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" :loading="loading" @click="resetQuery">
|
||||
<el-icon><RefreshLeft /></el-icon>重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleQuery">
|
||||
<el-icon><Search /></el-icon>查询
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-card shadow="hover" class="summary-card">
|
||||
<div class="card-icon" style="background: #f0f9ff">
|
||||
<el-icon :size="32" color="#67c23a"><CircleCheck /></el-icon>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="card-value success">{{ summary.wonOpportunities }}</div>
|
||||
<div class="card-label">赢单数量</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-card shadow="hover" class="summary-card">
|
||||
<div class="card-icon" style="background: #fff7e6">
|
||||
<el-icon :size="32" color="#e6a23c"><TrendCharts /></el-icon>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="card-value warning">{{ summary.overallConversionRate }}%</div>
|
||||
<div class="card-label">总转化率</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-card shadow="hover" class="summary-card">
|
||||
<div class="card-icon" style="background: #f0f9ff">
|
||||
<el-icon :size="32" color="#409eff"><Money /></el-icon>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="card-value primary">¥{{ formatAmount(summary.totalAmount) }}</div>
|
||||
<div class="card-label">商机总金额</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 漏斗图 -->
|
||||
<el-card shadow="never" class="funnel-card">
|
||||
<template #header>
|
||||
<span class="card-title">销售漏斗分析</span>
|
||||
</template>
|
||||
<div v-loading="loading" class="funnel-container">
|
||||
<div ref="funnelChartRef" class="funnel-chart"></div>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 阶段明细表格 -->
|
||||
<el-card shadow="never" class="detail-card">
|
||||
<template #header>
|
||||
<span class="card-title">阶段转化明细</span>
|
||||
</template>
|
||||
<el-table :data="funnelData" border>
|
||||
<el-table-column label="商机阶段" prop="stageName" align="center" />
|
||||
<el-table-column label="商机数量" prop="count" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag type="primary">{{ scope.row.count }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商机金额" prop="totalAmount" align="right" header-align="right">
|
||||
<template #default="scope">
|
||||
<span class="amount-text">¥{{ formatAmount(scope.row.totalAmount) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="平均赢单率" prop="avgWinRate" align="center">
|
||||
<template #default="scope"> {{ scope.row.avgWinRate }}% </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="转化率" prop="conversionRate" align="center">
|
||||
<template #default="scope">
|
||||
<el-progress :percentage="parseFloat(scope.row.conversionRate)" :color="getProgressColor(scope.row.conversionRate)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<div class="stat-grid">
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon primary">
|
||||
<el-icon><Opportunity /></el-icon>
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-title">商机总数</div>
|
||||
<div class="stat-value">{{ summary.totalOpportunities }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon success">
|
||||
<el-icon><CircleCheck /></el-icon>
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-title">赢单数量</div>
|
||||
<div class="stat-value">{{ summary.wonOpportunities }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon warning">
|
||||
<el-icon><TrendCharts /></el-icon>
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-title">总转化率</div>
|
||||
<div class="stat-value">{{ summary.overallConversionRate }}%</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon primary">
|
||||
<el-icon><Money /></el-icon>
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-title">商机总金额</div>
|
||||
<div class="stat-value money">¥{{ formatAmount(summary.totalAmount) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="chart-panel chart-panel-full">
|
||||
<div class="chart-panel-head">
|
||||
<span class="chart-title">销售漏斗分析</span>
|
||||
</div>
|
||||
<div v-loading="loading" class="chart-container chart-container-tall">
|
||||
<div ref="funnelChartRef" class="funnel-chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="chart-panel chart-panel-full">
|
||||
<div class="chart-panel-head">
|
||||
<span class="chart-title">阶段转化明细</span>
|
||||
</div>
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="funnelData" stripe>
|
||||
<el-table-column label="商机阶段" prop="stageName" min-width="120" align="center" />
|
||||
<el-table-column label="商机数量" prop="count" min-width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag type="primary" size="small">{{ scope.row.count }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商机金额" prop="totalAmount" min-width="140" align="right" class-name="col-money">
|
||||
<template #default="scope">¥{{ formatAmount(scope.row.totalAmount) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="平均赢单率" prop="avgWinRate" min-width="110" align="center">
|
||||
<template #default="scope">{{ scope.row.avgWinRate }}%</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="转化率" prop="conversionRate" min-width="180" align="center">
|
||||
<template #default="scope">
|
||||
<el-progress
|
||||
:percentage="parseFloat(scope.row.conversionRate)"
|
||||
:color="getProgressColor(scope.row.conversionRate)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="OpportunityFunnel">
|
||||
import { ref, reactive, onMounted, nextTick } from 'vue';
|
||||
import { getSalesFunnel } from '@/api/crm/opportunity';
|
||||
import * as echarts from 'echarts';
|
||||
import type { ECharts } from 'echarts';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { Opportunity, CircleCheck, TrendCharts, Money } from '@element-plus/icons-vue';
|
||||
import { ref, reactive, onMounted, onBeforeUnmount, nextTick } from 'vue'
|
||||
import { getSalesFunnel } from '@/api/crm/opportunity'
|
||||
import * as echarts from 'echarts'
|
||||
import type { ECharts } from 'echarts'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Opportunity, CircleCheck, TrendCharts, Money, Search, RefreshLeft } from '@element-plus/icons-vue'
|
||||
|
||||
const loading = ref(false);
|
||||
const queryFormRef = ref();
|
||||
const funnelChartRef = ref();
|
||||
let funnelChart: ECharts | null = null;
|
||||
const MINT_DARK = '#059669'
|
||||
const MINT_PALETTE = ['#10b981', '#34d399', '#059669', '#047857', '#6ee7b7', '#0d9488', '#14b8a6']
|
||||
|
||||
const loading = ref(false)
|
||||
const queryFormRef = ref()
|
||||
const funnelChartRef = ref<HTMLElement>()
|
||||
let funnelChart: ECharts | null = null
|
||||
|
||||
// 查询参数
|
||||
const queryParams = ref<{
|
||||
ownerUserId?: number;
|
||||
timeRange?: string[];
|
||||
ownerUserId?: number
|
||||
timeRange?: string[]
|
||||
}>({
|
||||
timeRange: []
|
||||
});
|
||||
})
|
||||
|
||||
// 汇总数据
|
||||
const summary = reactive({
|
||||
totalOpportunities: 0,
|
||||
wonOpportunities: 0,
|
||||
overallConversionRate: '0.00',
|
||||
totalAmount: 0
|
||||
});
|
||||
})
|
||||
|
||||
// 漏斗数据
|
||||
const funnelData = ref<any[]>([]);
|
||||
const funnelData = ref<any[]>([])
|
||||
|
||||
/** 加载漏斗数据 */
|
||||
const loadFunnelData = async () => {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
try {
|
||||
const params: any = {
|
||||
ownerUserId: queryParams.value.ownerUserId
|
||||
};
|
||||
|
||||
if (queryParams.value.timeRange && queryParams.value.timeRange.length === 2) {
|
||||
params.beginTime = queryParams.value.timeRange[0];
|
||||
params.endTime = queryParams.value.timeRange[1];
|
||||
}
|
||||
|
||||
const res = await getSalesFunnel(params);
|
||||
if (queryParams.value.timeRange && queryParams.value.timeRange.length === 2) {
|
||||
params.beginTime = queryParams.value.timeRange[0]
|
||||
params.endTime = queryParams.value.timeRange[1]
|
||||
}
|
||||
|
||||
// 更新汇总数据
|
||||
Object.assign(summary, res.data.summary || {});
|
||||
const res = await getSalesFunnel(params)
|
||||
Object.assign(summary, res.data.summary || {})
|
||||
funnelData.value = res.data.funnelData || []
|
||||
|
||||
// 更新漏斗数据
|
||||
funnelData.value = res.data.funnelData || [];
|
||||
|
||||
// 渲染漏斗图
|
||||
await nextTick();
|
||||
renderFunnelChart();
|
||||
await nextTick()
|
||||
renderFunnelChart()
|
||||
} catch (error) {
|
||||
console.error('加载漏斗数据失败:', error);
|
||||
ElMessage.error('加载漏斗数据失败');
|
||||
console.error('加载漏斗数据失败:', error)
|
||||
ElMessage.error('加载漏斗数据失败')
|
||||
} finally {
|
||||
loading.value = false;
|
||||
loading.value = false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** 渲染漏斗图 */
|
||||
const renderFunnelChart = () => {
|
||||
if (!funnelChartRef.value) return;
|
||||
if (!funnelChartRef.value) return
|
||||
|
||||
// 初始化图表
|
||||
if (!funnelChart) {
|
||||
funnelChart = echarts.init(funnelChartRef.value);
|
||||
funnelChart = echarts.init(funnelChartRef.value)
|
||||
}
|
||||
|
||||
// 准备数据
|
||||
const chartData = funnelData.value.map((item) => ({
|
||||
name: `${item.stageName} (${item.count})`,
|
||||
value: item.count
|
||||
}));
|
||||
}))
|
||||
|
||||
// 配置项
|
||||
const option = {
|
||||
funnelChart.setOption({
|
||||
title: {
|
||||
text: '商机阶段转化漏斗',
|
||||
left: 'center',
|
||||
textStyle: {
|
||||
fontSize: 16,
|
||||
fontWeight: 600
|
||||
fontWeight: 600,
|
||||
color: '#1e293b'
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: (params: any) => {
|
||||
const data = funnelData.value[params.dataIndex];
|
||||
const data = funnelData.value[params.dataIndex]
|
||||
return `
|
||||
<div style="padding: 8px;">
|
||||
<div style="font-weight: 600; margin-bottom: 8px;">${data.stageName}</div>
|
||||
@@ -224,12 +211,10 @@ const renderFunnelChart = () => {
|
||||
<div>平均赢单率: ${data.avgWinRate}%</div>
|
||||
<div>转化率: ${data.conversionRate}%</div>
|
||||
</div>
|
||||
`;
|
||||
`
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
show: false
|
||||
},
|
||||
legend: { show: false },
|
||||
series: [
|
||||
{
|
||||
name: '商机漏斗',
|
||||
@@ -253,152 +238,170 @@ const renderFunnelChart = () => {
|
||||
},
|
||||
labelLine: {
|
||||
length: 10,
|
||||
lineStyle: {
|
||||
width: 1,
|
||||
type: 'solid'
|
||||
}
|
||||
lineStyle: { width: 1, type: 'solid' }
|
||||
},
|
||||
itemStyle: {
|
||||
borderColor: '#fff',
|
||||
borderWidth: 1
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
fontSize: 16
|
||||
}
|
||||
label: { fontSize: 16 }
|
||||
},
|
||||
data: chartData,
|
||||
// 颜色渐变
|
||||
color: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452']
|
||||
color: MINT_PALETTE
|
||||
}
|
||||
]
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
funnelChart.setOption(option);
|
||||
|
||||
// 响应式
|
||||
window.addEventListener('resize', () => {
|
||||
funnelChart?.resize();
|
||||
});
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
loadFunnelData();
|
||||
};
|
||||
loadFunnelData()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
loadFunnelData();
|
||||
};
|
||||
queryFormRef.value?.resetFields()
|
||||
loadFunnelData()
|
||||
}
|
||||
|
||||
/** 格式化金额 */
|
||||
const formatAmount = (amount: number) => {
|
||||
if (!amount) return '0.00';
|
||||
if (!amount) return '0.00'
|
||||
return amount.toLocaleString('zh-CN', {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
/** 获取进度条颜色 */
|
||||
const getProgressColor = (rate: number) => {
|
||||
const numRate = parseFloat(rate);
|
||||
if (numRate >= 70) return '#67c23a';
|
||||
if (numRate >= 40) return '#e6a23c';
|
||||
return '#f56c6c';
|
||||
};
|
||||
const getProgressColor = (rate: number | string) => {
|
||||
const numRate = parseFloat(String(rate))
|
||||
if (numRate >= 70) return MINT_DARK
|
||||
if (numRate >= 40) return '#d97706'
|
||||
return '#dc2626'
|
||||
}
|
||||
|
||||
const handleResize = () => {
|
||||
funnelChart?.resize()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadFunnelData();
|
||||
});
|
||||
loadFunnelData()
|
||||
window.addEventListener('resize', handleResize)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', handleResize)
|
||||
funnelChart?.dispose()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.opportunity-funnel {
|
||||
.filter-card {
|
||||
margin-bottom: 16px;
|
||||
.opportunity-funnel-page {
|
||||
.stat-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
padding: 0 16px 16px;
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.summary-row {
|
||||
margin-bottom: 16px;
|
||||
.stat-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
background: var(--mint-surface, #fff);
|
||||
border: 1px solid var(--mint-border, #d9e8e2);
|
||||
border-radius: var(--mint-radius, 10px);
|
||||
}
|
||||
|
||||
.summary-card {
|
||||
:deep(.el-card__body) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 20px;
|
||||
}
|
||||
.stat-icon {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 24px;
|
||||
margin-right: 14px;
|
||||
|
||||
.card-icon {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
&.primary {
|
||||
background: var(--primary-bg, #ecfdf5);
|
||||
color: var(--primary, #10b981);
|
||||
}
|
||||
|
||||
.card-content {
|
||||
flex: 1;
|
||||
&.success {
|
||||
background: rgba(16, 185, 129, 0.12);
|
||||
color: var(--primary-dark, #059669);
|
||||
}
|
||||
|
||||
.card-value {
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 4px;
|
||||
&.warning {
|
||||
background: rgba(217, 119, 6, 0.12);
|
||||
color: #d97706;
|
||||
}
|
||||
}
|
||||
|
||||
&.success {
|
||||
color: #67c23a;
|
||||
}
|
||||
.stat-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
&.warning {
|
||||
color: #e6a23c;
|
||||
}
|
||||
.stat-title {
|
||||
font-size: 13px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
&.primary {
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
.stat-value {
|
||||
font-size: 26px;
|
||||
font-weight: 700;
|
||||
color: var(--mint-text, #1e293b);
|
||||
line-height: 1.2;
|
||||
|
||||
.card-label {
|
||||
font-size: 14px;
|
||||
color: #1e293b;
|
||||
}
|
||||
&.money {
|
||||
font-size: 22px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.funnel-card {
|
||||
margin-bottom: 16px;
|
||||
|
||||
.card-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.funnel-container {
|
||||
min-height: 500px;
|
||||
|
||||
.funnel-chart {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
}
|
||||
.chart-panel {
|
||||
background: var(--mint-surface, #fff);
|
||||
border: 1px solid var(--mint-border, #d9e8e2);
|
||||
border-radius: var(--mint-radius, 10px);
|
||||
overflow: hidden;
|
||||
margin: 0 16px 16px;
|
||||
}
|
||||
|
||||
.detail-card {
|
||||
.card-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.chart-panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 14px 16px;
|
||||
border-bottom: 1px solid var(--mint-border, #d9e8e2);
|
||||
}
|
||||
|
||||
.amount-text {
|
||||
color: #67c23a;
|
||||
font-weight: 600;
|
||||
}
|
||||
.chart-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--mint-text, #1e293b);
|
||||
}
|
||||
|
||||
.chart-container {
|
||||
min-height: 360px;
|
||||
padding: 8px 12px 16px;
|
||||
}
|
||||
|
||||
.chart-container-tall {
|
||||
min-height: 500px;
|
||||
}
|
||||
|
||||
.funnel-chart {
|
||||
width: 100%;
|
||||
height: 480px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -6,12 +6,14 @@
|
||||
<h2 class="title-bar-heading">商机管理</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-tabs">
|
||||
<el-tabs v-model="activeView" @tab-change="handleViewChange">
|
||||
<el-tab-pane label="我的商机" name="mine" />
|
||||
<el-tab-pane label="全部商机" name="all" />
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-tabs
|
||||
v-model="activeView"
|
||||
class="panel-pill-tabs panel-pill-tabs--lg"
|
||||
@tab-change="handleViewChange"
|
||||
>
|
||||
<el-tab-pane label="我的商机" name="mine" />
|
||||
<el-tab-pane label="全部商机" name="all" />
|
||||
</el-tabs>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form ref="queryFormRef" :model="queryParams" class="filter-form" @submit.prevent>
|
||||
@@ -119,6 +121,28 @@
|
||||
>
|
||||
<el-icon><Plus /></el-icon>新增商机
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasOpportunityPerm('edit')"
|
||||
class="btn-ghost"
|
||||
:disabled="
|
||||
selectedRows.length !== 1 ||
|
||||
selectedRows[0]?.status === 'won' ||
|
||||
selectedRows[0]?.status === 'lost'
|
||||
"
|
||||
@click="handleUpdate()"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasOpportunityPerm('remove')"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="canDeleteByCreator(selectedRows[0]) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete()"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasOpportunityPerm('assign')"
|
||||
class="btn-ghost"
|
||||
@@ -127,6 +151,16 @@
|
||||
>
|
||||
<el-icon><User /></el-icon>批量分配
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="getList"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -314,23 +348,6 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column v-if="isColumnVisible('remark')" label="备注" align="center" header-align="center" prop="remark" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column label="操作" min-width="200" align="center" header-align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button v-if="hasOpportunityPerm('query')" class="btn-op-item" @click="handleDetail(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasOpportunityPerm('edit')"
|
||||
class="btn-op-item primary"
|
||||
:disabled="row.status === 'won' || row.status === 'lost'"
|
||||
@click="handleUpdate(row)"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -402,46 +419,12 @@
|
||||
|
||||
<!-- 商机详情弹窗 -->
|
||||
<OpportunityDetailDrawer v-model="detailVisible" :opportunity-id="currentId" @success="getList" />
|
||||
|
||||
<!-- 列设置对话框 -->
|
||||
<el-dialog
|
||||
v-model="columnSettingDialog.visible"
|
||||
title="列设置"
|
||||
width="600px"
|
||||
class="dialog-form-layout"
|
||||
align-center
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div class="column-setting-content">
|
||||
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">全选</el-checkbox>
|
||||
<el-divider />
|
||||
<el-checkbox-group v-model="visibleColumns" @change="handleCheckedColumnsChange">
|
||||
<div v-for="col in tableColumns" :key="col.prop" class="column-item">
|
||||
<el-checkbox :label="col.prop" :disabled="col.fixed">{{ col.label }}</el-checkbox>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button class="btn-ghost" @click="columnSettingDialog.visible = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleResetColumns">
|
||||
<el-icon><RefreshLeft /></el-icon>恢复默认
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" @click="handleSaveColumnSetting">
|
||||
<el-icon><Check /></el-icon>保存
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="CrmOpportunity">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { ElForm } from 'element-plus'
|
||||
@@ -454,12 +437,12 @@ import {
|
||||
User,
|
||||
ArrowUpBold,
|
||||
ArrowDownBold,
|
||||
View,
|
||||
Edit
|
||||
Edit,
|
||||
Delete
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { useOpportunityPerm } from '@/hooks/business/useOpportunityPerm'
|
||||
import { filterDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { filterDeletableByCreator, canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { fetchUserOptions } from '@/api/admin'
|
||||
import { listOpportunity, listMyOpportunity, delOpportunity, assignOpportunity, exportOpportunity } from '@/api/crm/opportunity'
|
||||
import type { OpportunityQuery, OpportunityVO } from '@/api/crm/opportunity/types'
|
||||
@@ -471,6 +454,8 @@ import FollowDialog from './components/FollowDialog.vue'
|
||||
import BatchUpdateStageDialog from './components/BatchUpdateStageDialog.vue'
|
||||
import BatchUpdateDateDialog from './components/BatchUpdateDateDialog.vue'
|
||||
import OpportunityDetailDrawer from './components/OpportunityDetailDrawer.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const router = useRouter()
|
||||
@@ -481,127 +466,56 @@ const selectedRows = ref<OpportunityVO[]>([])
|
||||
const exportLoading = ref(false)
|
||||
const assignLoading = ref(false)
|
||||
|
||||
// 列配置相关
|
||||
const COLUMN_STORAGE_KEY = 'crm_opportunity_visible_columns';
|
||||
// 列配置
|
||||
const listColumnDefs = [
|
||||
{ prop: 'customerName', label: '客户名称' },
|
||||
{ prop: 'contactName', label: '联系人' },
|
||||
{ prop: 'amount', label: '商机金额' },
|
||||
{ prop: 'stage', label: '商机阶段' },
|
||||
{ prop: 'stagePercent', label: '阶段进度' },
|
||||
{ prop: 'status', label: '商机状态' },
|
||||
{ prop: 'winRate', label: '赢单率' },
|
||||
{ prop: 'expectDealDate', label: '预计成交日期' },
|
||||
{ prop: 'actualDealDate', label: '实际成交日期' },
|
||||
{ prop: 'source', label: '商机来源' },
|
||||
{ prop: 'type', label: '商机类型' },
|
||||
{ prop: 'description', label: '商机描述' },
|
||||
{ prop: 'competitors', label: '竞争对手' },
|
||||
{ prop: 'keyFactors', label: '关键决策因素' },
|
||||
{ prop: 'lostReason', label: '输单原因' },
|
||||
{ prop: 'ownerUserName', label: '负责人' },
|
||||
{ prop: 'productCount', label: '产品数量' },
|
||||
{ prop: 'followCount', label: '跟进次数' },
|
||||
{ prop: 'lastTime', label: '最后跟进时间' },
|
||||
{ prop: 'nextTime', label: '下次联系时间' },
|
||||
{ prop: 'stageChangeTime', label: '阶段变更时间' },
|
||||
{ prop: 'createDeptName', label: '创建部门' },
|
||||
{ prop: 'createByName', label: '创建人' },
|
||||
{ prop: 'createTime', label: '创建时间' },
|
||||
{ prop: 'updateByName', label: '更新人' },
|
||||
{ prop: 'updateTime', label: '更新时间' },
|
||||
{ prop: 'remark', label: '备注' }
|
||||
]
|
||||
|
||||
// 定义所有列配置(顺序代表显示顺序)
|
||||
const tableColumns = ref([
|
||||
{ prop: 'customerName', label: '客户名称', fixed: false },
|
||||
{ prop: 'contactName', label: '联系人', fixed: false },
|
||||
{ prop: 'amount', label: '商机金额', fixed: false },
|
||||
{ prop: 'stage', label: '商机阶段', fixed: false },
|
||||
{ prop: 'stagePercent', label: '阶段进度', fixed: false },
|
||||
{ prop: 'status', label: '商机状态', fixed: false },
|
||||
{ prop: 'winRate', label: '赢单率', fixed: false },
|
||||
{ prop: 'expectDealDate', label: '预计成交日期', fixed: false },
|
||||
{ prop: 'actualDealDate', label: '实际成交日期', fixed: false },
|
||||
{ prop: 'source', label: '商机来源', fixed: false },
|
||||
{ prop: 'type', label: '商机类型', fixed: false },
|
||||
{ prop: 'description', label: '商机描述', fixed: false },
|
||||
{ prop: 'competitors', label: '竞争对手', fixed: false },
|
||||
{ prop: 'keyFactors', label: '关键决策因素', fixed: false },
|
||||
{ prop: 'lostReason', label: '输单原因', fixed: false },
|
||||
{ prop: 'ownerUserName', label: '负责人', fixed: false },
|
||||
{ prop: 'productCount', label: '产品数量', fixed: false },
|
||||
{ prop: 'followCount', label: '跟进次数', fixed: false },
|
||||
{ prop: 'lastTime', label: '最后跟进时间', fixed: false },
|
||||
{ prop: 'nextTime', label: '下次联系时间', fixed: false },
|
||||
{ prop: 'stageChangeTime', label: '阶段变更时间', fixed: false },
|
||||
{ prop: 'createDeptName', label: '创建部门', fixed: false },
|
||||
{ prop: 'createByName', label: '创建人', fixed: false },
|
||||
{ prop: 'createTime', label: '创建时间', fixed: false },
|
||||
{ prop: 'updateByName', label: '更新人', fixed: false },
|
||||
{ prop: 'updateTime', label: '更新时间', fixed: false },
|
||||
{ prop: 'remark', label: '备注', fixed: false }
|
||||
]);
|
||||
|
||||
// 默认显示的列(现有字段)
|
||||
const defaultVisibleColumns = [
|
||||
'customerName',
|
||||
'stage',
|
||||
'stagePercent',
|
||||
'winRate',
|
||||
'expectDealDate',
|
||||
'status',
|
||||
'ownerUserName',
|
||||
'followCount',
|
||||
'createTime'
|
||||
];
|
||||
|
||||
// 当前显示的列
|
||||
const visibleColumns = ref<string[]>([]);
|
||||
|
||||
// 列设置对话框
|
||||
const columnSettingDialog = reactive({
|
||||
visible: false
|
||||
});
|
||||
|
||||
// 全选状态
|
||||
const checkAll = ref(false);
|
||||
const isIndeterminate = ref(false);
|
||||
|
||||
/** 初始化列配置 */
|
||||
const initColumnSetting = () => {
|
||||
const savedColumns = localStorage.getItem(COLUMN_STORAGE_KEY);
|
||||
if (savedColumns) {
|
||||
try {
|
||||
visibleColumns.value = JSON.parse(savedColumns);
|
||||
} catch (error) {
|
||||
console.error('解析列配置失败:', error);
|
||||
visibleColumns.value = [...defaultVisibleColumns];
|
||||
}
|
||||
} else {
|
||||
visibleColumns.value = [...defaultVisibleColumns];
|
||||
}
|
||||
updateCheckAllStatus();
|
||||
};
|
||||
|
||||
/** 判断列是否显示 */
|
||||
const isColumnVisible = (prop: string) => {
|
||||
return visibleColumns.value.includes(prop);
|
||||
};
|
||||
|
||||
/** 打开列设置对话框 */
|
||||
const handleColumnSetting = () => {
|
||||
columnSettingDialog.visible = true;
|
||||
};
|
||||
|
||||
/** 全选/取消全选 */
|
||||
const handleCheckAllChange = (val: boolean) => {
|
||||
visibleColumns.value = val ? tableColumns.value.map((col) => col.prop) : [];
|
||||
isIndeterminate.value = false;
|
||||
};
|
||||
|
||||
/** 列选择变化 */
|
||||
const handleCheckedColumnsChange = () => {
|
||||
updateCheckAllStatus();
|
||||
};
|
||||
|
||||
/** 更新全选状态 */
|
||||
const updateCheckAllStatus = () => {
|
||||
const checkedCount = visibleColumns.value.length;
|
||||
const totalCount = tableColumns.value.length;
|
||||
checkAll.value = checkedCount === totalCount;
|
||||
isIndeterminate.value = checkedCount > 0 && checkedCount < totalCount;
|
||||
};
|
||||
|
||||
/** 恢复默认列设置 */
|
||||
const handleResetColumns = () => {
|
||||
visibleColumns.value = [...defaultVisibleColumns];
|
||||
updateCheckAllStatus();
|
||||
};
|
||||
|
||||
/** 保存列设置 */
|
||||
const handleSaveColumnSetting = () => {
|
||||
try {
|
||||
localStorage.setItem(COLUMN_STORAGE_KEY, JSON.stringify(visibleColumns.value));
|
||||
ElMessage.success('列设置保存成功')
|
||||
columnSettingDialog.visible = false;
|
||||
} catch (error) {
|
||||
console.error('保存列配置失败:', error);
|
||||
ElMessage.error('保存列设置失败')
|
||||
}
|
||||
};
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('crm_opportunity_visible_columns', listColumnDefs, {
|
||||
defaultVisibleProps: [
|
||||
'customerName',
|
||||
'stage',
|
||||
'stagePercent',
|
||||
'winRate',
|
||||
'expectDealDate',
|
||||
'status',
|
||||
'ownerUserName',
|
||||
'followCount',
|
||||
'createTime'
|
||||
]
|
||||
})
|
||||
|
||||
// 当前视图
|
||||
const activeView = ref('mine');
|
||||
@@ -612,7 +526,7 @@ const viewMode = ref<'list' | 'kanban'>('list');
|
||||
// 查询参数
|
||||
const queryParams = ref<OpportunityQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
opportunityName: undefined,
|
||||
customerName: undefined,
|
||||
stage: undefined,
|
||||
@@ -1010,7 +924,6 @@ watchDebounced(
|
||||
// 初始化加载数据
|
||||
onMounted(async () => {
|
||||
await loadPerms()
|
||||
initColumnSetting();
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
@@ -1024,22 +937,4 @@ onMounted(async () => {
|
||||
.quick-search-icon {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.column-setting-content {
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
|
||||
.column-item {
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
:deep(.el-checkbox) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,20 +1,20 @@
|
||||
<template>
|
||||
<div class="app-container opportunity-kanban">
|
||||
<!-- 查询筛选栏 -->
|
||||
<el-card shadow="hover" class="mb-[10px]">
|
||||
<el-form :model="queryParams" ref="queryFormRef" label-width="90px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<div class="page-container opportunity-kanban-page">
|
||||
<section class="panel kanban-panel">
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">商机看板</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form ref="queryFormRef" class="filter-form" :model="queryParams" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
<el-form-item label="负责人" prop="ownerUserId">
|
||||
<el-select v-model="queryParams.ownerUserId" placeholder="请选择负责人" clearable style="width: 100%">
|
||||
<!-- TODO: 从用户列表获取 -->
|
||||
<el-select v-model="queryParams.ownerUserId" placeholder="请选择负责人" clearable>
|
||||
<el-option label="全部" :value="undefined" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xl="4" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<el-form-item label="商机来源" prop="source">
|
||||
<el-select v-model="queryParams.source" placeholder="请选择商机来源" clearable style="width: 100%">
|
||||
<el-select v-model="queryParams.source" placeholder="请选择商机来源" clearable>
|
||||
<el-option label="全部" :value="undefined" />
|
||||
<el-option label="电话咨询" value="phone" />
|
||||
<el-option label="网络推广" value="online" />
|
||||
@@ -24,78 +24,82 @@
|
||||
<el-option label="其他" value="other" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24" style="text-align: right">
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 看板区域 -->
|
||||
<div class="kanban-container" v-loading="loading">
|
||||
<div v-for="stage in stageColumns" :key="stage.key" class="kanban-column">
|
||||
<!-- 列头 -->
|
||||
<div class="column-header">
|
||||
<div class="header-title">
|
||||
<span class="stage-name">{{ stage.name }}</span>
|
||||
<el-tag size="small" type="info">{{ stage.count }}</el-tag>
|
||||
</div>
|
||||
<div class="header-amount">¥{{ formatAmount(stage.totalAmount) }}</div>
|
||||
</div>
|
||||
|
||||
<!-- 卡片列表 -->
|
||||
<div class="column-content">
|
||||
<div v-for="opp in stage.opportunities" :key="opp.id" class="opportunity-card" @click="handleViewDetail(opp.id)">
|
||||
<div class="card-header">
|
||||
<span class="card-title">{{ opp.opportunityName }}</span>
|
||||
<el-dropdown trigger="click" @command="(cmd) => handleCardAction(cmd, opp)">
|
||||
<el-icon class="card-more"><MoreFilled /></el-icon>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="edit">修改</el-dropdown-item>
|
||||
<el-dropdown-item command="stage">推进阶段</el-dropdown-item>
|
||||
<el-dropdown-item command="follow">添加跟进</el-dropdown-item>
|
||||
<el-dropdown-item command="won" divided>标记赢单</el-dropdown-item>
|
||||
<el-dropdown-item command="lost">标记输单</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
|
||||
<div class="card-info">
|
||||
<div class="info-row">
|
||||
<el-icon><User /></el-icon>
|
||||
<span>{{ opp.customerName }}</span>
|
||||
</div>
|
||||
<div class="info-row amount">
|
||||
<el-icon><Money /></el-icon>
|
||||
<span>¥{{ formatAmount(opp.amount) }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<el-icon><Calendar /></el-icon>
|
||||
<span>{{ formatDate(opp.expectDealDate) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<el-progress :percentage="opp.stagePercent" :stroke-width="4" :show-text="false" />
|
||||
<span class="win-rate">赢单率: {{ opp.winRate }}%</span>
|
||||
<div class="filter-actions">
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" :loading="loading" @click="resetQuery">
|
||||
<el-icon><RefreshLeft /></el-icon>重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleQuery">
|
||||
<el-icon><Search /></el-icon>查询
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<div v-if="stage.opportunities.length === 0" class="column-empty">
|
||||
<el-empty description="暂无商机" :image-size="80" />
|
||||
<div class="kanban-container" v-loading="loading">
|
||||
<div v-for="stage in stageColumns" :key="stage.key" class="kanban-column">
|
||||
<div class="column-header">
|
||||
<div class="header-title">
|
||||
<span class="stage-name">{{ stage.name }}</span>
|
||||
<el-tag size="small" type="info">{{ stage.count }}</el-tag>
|
||||
</div>
|
||||
<div class="header-amount">¥{{ formatAmount(stage.totalAmount) }}</div>
|
||||
</div>
|
||||
|
||||
<div class="column-content">
|
||||
<div
|
||||
v-for="opp in stage.opportunities"
|
||||
:key="opp.id"
|
||||
class="opportunity-card"
|
||||
@click="handleViewDetail(opp.id)"
|
||||
>
|
||||
<div class="card-header">
|
||||
<span class="card-title">{{ opp.opportunityName }}</span>
|
||||
<el-dropdown trigger="click" @command="(cmd) => handleCardAction(cmd, opp)">
|
||||
<el-icon class="card-more" @click.stop><MoreFilled /></el-icon>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="edit">修改</el-dropdown-item>
|
||||
<el-dropdown-item command="stage">推进阶段</el-dropdown-item>
|
||||
<el-dropdown-item command="follow">添加跟进</el-dropdown-item>
|
||||
<el-dropdown-item command="won" divided>标记赢单</el-dropdown-item>
|
||||
<el-dropdown-item command="lost">标记输单</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
|
||||
<div class="card-info">
|
||||
<div class="info-row">
|
||||
<el-icon><User /></el-icon>
|
||||
<span>{{ opp.customerName }}</span>
|
||||
</div>
|
||||
<div class="info-row amount">
|
||||
<el-icon><Money /></el-icon>
|
||||
<span>¥{{ formatAmount(opp.amount) }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<el-icon><Calendar /></el-icon>
|
||||
<span>{{ formatDate(opp.expectDealDate) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<el-progress :percentage="opp.stagePercent" :stroke-width="4" :show-text="false" />
|
||||
<span class="win-rate">赢单率: {{ opp.winRate }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="stage.opportunities.length === 0" class="column-empty">
|
||||
<el-empty description="暂无商机" :image-size="80" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 对话框组件 -->
|
||||
<ChangeStageDialog ref="changeStageDialogRef" @success="loadKanbanData" />
|
||||
<MarkWonDialog ref="markWonDialogRef" @success="loadKanbanData" />
|
||||
<MarkLostDialog ref="markLostDialogRef" @success="loadKanbanData" />
|
||||
@@ -104,7 +108,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="OpportunityKanban">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { getKanbanData } from '@/api/crm/opportunity'
|
||||
@@ -114,140 +118,123 @@ import MarkWonDialog from './components/MarkWonDialog.vue'
|
||||
import MarkLostDialog from './components/MarkLostDialog.vue'
|
||||
import FollowDialog from './components/FollowDialog.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { MoreFilled, User, Money, Calendar } from '@element-plus/icons-vue'
|
||||
import { MoreFilled, User, Money, Calendar, Search, RefreshLeft } from '@element-plus/icons-vue'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
const queryFormRef = ref()
|
||||
|
||||
// 查询参数
|
||||
const queryParams = ref<OpportunityQuery>({});
|
||||
const queryParams = ref<OpportunityQuery>({})
|
||||
|
||||
// 阶段颜色配置(补充字典中没有的颜色信息)
|
||||
const stageColors: Record<string, string> = {
|
||||
initial: '#909399',
|
||||
requirement: '#409EFF',
|
||||
solution: '#67C23A',
|
||||
quote: '#E6A23C',
|
||||
negotiate: '#F56C6C',
|
||||
contract: '#9C27B0'
|
||||
};
|
||||
|
||||
// 看板列数据
|
||||
interface StageColumn {
|
||||
key: string;
|
||||
name: string;
|
||||
color: string;
|
||||
count: number;
|
||||
totalAmount: number;
|
||||
opportunities: OpportunityVO[];
|
||||
initial: '#64748b',
|
||||
requirement: '#10b981',
|
||||
solution: '#059669',
|
||||
quote: '#d97706',
|
||||
negotiate: '#047857',
|
||||
contract: '#0d9488'
|
||||
}
|
||||
|
||||
const stageColumns = ref<StageColumn[]>([]);
|
||||
interface StageColumn {
|
||||
key: string
|
||||
name: string
|
||||
color: string
|
||||
count: number
|
||||
totalAmount: number
|
||||
opportunities: OpportunityVO[]
|
||||
}
|
||||
|
||||
// 对话框引用
|
||||
const changeStageDialogRef = ref();
|
||||
const markWonDialogRef = ref();
|
||||
const markLostDialogRef = ref();
|
||||
const followDialogRef = ref();
|
||||
const stageColumns = ref<StageColumn[]>([])
|
||||
|
||||
const changeStageDialogRef = ref()
|
||||
const markWonDialogRef = ref()
|
||||
const markLostDialogRef = ref()
|
||||
const followDialogRef = ref()
|
||||
|
||||
/** 加载看板数据 */
|
||||
const loadKanbanData = async () => {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getKanbanData(queryParams.value);
|
||||
|
||||
// 转换数据格式,使用字典数据
|
||||
stageColumns.value = dictStore.getOptions('crm_opportunity_stage')
|
||||
.filter((stage: any) => stage.value !== 'won') // 排除赢单阶段(已完成的商机)
|
||||
const res = await getKanbanData(queryParams.value)
|
||||
stageColumns.value = dictStore
|
||||
.getOptions('crm_opportunity_stage')
|
||||
.filter((stage: any) => stage.value !== 'won')
|
||||
.map((stage: any) => {
|
||||
const stageData = res.data[stage.value] || {};
|
||||
const stageData = res.data[stage.value] || {}
|
||||
return {
|
||||
key: stage.value,
|
||||
name: stage.label,
|
||||
color: stageColors[stage.value] || '#909399',
|
||||
color: stageColors[stage.value] || '#64748b',
|
||||
count: stageData.count || 0,
|
||||
totalAmount: stageData.totalAmount || 0,
|
||||
opportunities: stageData.opportunities || []
|
||||
};
|
||||
});
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('加载看板数据失败:', error);
|
||||
ElMessage.error('加载看板数据失败');
|
||||
console.error('加载看板数据失败:', error)
|
||||
ElMessage.error('加载看板数据失败')
|
||||
} finally {
|
||||
loading.value = false;
|
||||
loading.value = false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
loadKanbanData();
|
||||
};
|
||||
loadKanbanData()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
loadKanbanData();
|
||||
};
|
||||
queryFormRef.value?.resetFields()
|
||||
loadKanbanData()
|
||||
}
|
||||
|
||||
/** 查看详情 */
|
||||
const handleViewDetail = (id: number) => {
|
||||
router.push({ path: '/crm/opportunity/detail', query: { id } });
|
||||
};
|
||||
router.push({ path: '/crm/opportunity/detail', query: { id } })
|
||||
}
|
||||
|
||||
/** 卡片操作 */
|
||||
const handleCardAction = (command: string, opp: OpportunityVO) => {
|
||||
switch (command) {
|
||||
case 'edit':
|
||||
router.push({ path: '/crm/opportunity', query: { id: opp.id, action: 'edit' } });
|
||||
break;
|
||||
router.push({ path: '/crm/opportunity', query: { id: opp.id, action: 'edit' } })
|
||||
break
|
||||
case 'stage':
|
||||
changeStageDialogRef.value?.open(opp.id);
|
||||
break;
|
||||
changeStageDialogRef.value?.open(opp.id)
|
||||
break
|
||||
case 'follow':
|
||||
followDialogRef.value?.open(opp.id);
|
||||
break;
|
||||
followDialogRef.value?.open(opp.id)
|
||||
break
|
||||
case 'won':
|
||||
markWonDialogRef.value?.open(opp.id);
|
||||
break;
|
||||
markWonDialogRef.value?.open(opp.id)
|
||||
break
|
||||
case 'lost':
|
||||
markLostDialogRef.value?.open(opp.id);
|
||||
break;
|
||||
markLostDialogRef.value?.open(opp.id)
|
||||
break
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** 格式化金额 */
|
||||
const formatAmount = (amount: number) => {
|
||||
if (!amount) return '0.00';
|
||||
if (!amount) return '0.00'
|
||||
return amount.toLocaleString('zh-CN', {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
/** 格式化日期 */
|
||||
const formatDate = (date: string) => {
|
||||
if (!date) return '-';
|
||||
return date.split(' ')[0];
|
||||
};
|
||||
if (!date) return '-'
|
||||
return date.split(' ')[0]
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadKanbanData();
|
||||
});
|
||||
loadKanbanData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.opportunity-kanban {
|
||||
height: calc(100vh - 120px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.kanban-filter {
|
||||
background: #fff;
|
||||
padding: 16px;
|
||||
margin-bottom: 16px;
|
||||
border-radius: 4px;
|
||||
.opportunity-kanban-page {
|
||||
.kanban-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: calc(100vh - 140px);
|
||||
}
|
||||
|
||||
.kanban-container {
|
||||
@@ -255,141 +242,145 @@ onMounted(() => {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 16px;
|
||||
padding: 16px;
|
||||
min-height: 420px;
|
||||
}
|
||||
|
||||
.kanban-column {
|
||||
flex: 0 0 300px;
|
||||
background: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
.kanban-column {
|
||||
flex: 0 0 300px;
|
||||
background: var(--mint-row-hover, #f1f5f9);
|
||||
border: 1px solid var(--mint-border, #d9e8e2);
|
||||
border-radius: var(--mint-radius, 10px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.column-header {
|
||||
padding: 14px 16px;
|
||||
background: var(--mint-surface, #fff);
|
||||
border-radius: 10px 10px 0 0;
|
||||
border-bottom: 1px solid var(--mint-border, #d9e8e2);
|
||||
|
||||
.header-title {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: fit-content;
|
||||
min-height: 400px;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
|
||||
.column-header {
|
||||
padding: 16px;
|
||||
background: #fff;
|
||||
border-radius: 4px 4px 0 0;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
.stage-name {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: var(--mint-text, #1e293b);
|
||||
}
|
||||
}
|
||||
|
||||
.header-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
.header-amount {
|
||||
font-size: 14px;
|
||||
color: var(--primary-dark, #059669);
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.stage-name {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
}
|
||||
.column-content {
|
||||
flex: 1;
|
||||
padding: 12px;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.header-amount {
|
||||
font-size: 14px;
|
||||
color: #67c23a;
|
||||
font-weight: 600;
|
||||
}
|
||||
.opportunity-card {
|
||||
background: var(--mint-surface, #fff);
|
||||
border: 1px solid var(--mint-border, #d9e8e2);
|
||||
border-radius: 8px;
|
||||
padding: 12px;
|
||||
cursor: pointer;
|
||||
transition: box-shadow 0.2s ease, transform 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--mint-shadow, 0 1px 3px rgba(0, 0, 0, 0.05));
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
|
||||
.card-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--mint-text, #1e293b);
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.column-content {
|
||||
flex: 1;
|
||||
padding: 12px;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
.card-more {
|
||||
font-size: 16px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
cursor: pointer;
|
||||
|
||||
.opportunity-card {
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
padding: 12px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
|
||||
.card-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.card-more {
|
||||
font-size: 16px;
|
||||
color: #1e293b;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
|
||||
.el-icon {
|
||||
font-size: 14px;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
&.amount {
|
||||
color: #67c23a;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
|
||||
:deep(.el-progress) {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.win-rate {
|
||||
font-size: 12px;
|
||||
color: #1e293b;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.column-empty {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 200px;
|
||||
&:hover {
|
||||
color: var(--primary, #10b981);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 13px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
|
||||
.el-icon {
|
||||
font-size: 14px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
}
|
||||
|
||||
&.amount {
|
||||
color: var(--primary-dark, #059669);
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
|
||||
:deep(.el-progress) {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.win-rate {
|
||||
font-size: 12px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.column-empty {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 200px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -4,7 +4,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>产品分类</h2>
|
||||
<h2 class="title-bar-heading">产品分类</h2>
|
||||
</div>
|
||||
|
||||
<!-- 筛选区 -->
|
||||
@@ -33,10 +33,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按分类名称模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset">
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset">
|
||||
<el-icon><RefreshLeft /></el-icon>重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch">
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch">
|
||||
<el-icon><Search /></el-icon>搜索
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -82,6 +82,8 @@
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="getList" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -220,6 +222,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ref, reactive, onMounted, nextTick, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>产品管理</h2>
|
||||
<h2 class="title-bar-heading">产品管理</h2>
|
||||
</div>
|
||||
|
||||
<!-- 筛选区 -->
|
||||
@@ -43,10 +43,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按产品名称、编号模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset">
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset">
|
||||
<el-icon><RefreshLeft /></el-icon>重置
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch">
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch">
|
||||
<el-icon><Search /></el-icon>搜索
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -64,6 +64,24 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增产品
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length === 0 || !allRowsDeletableByCreator(selectedRows)"
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete()"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length === 0"
|
||||
@@ -88,6 +106,16 @@
|
||||
<el-icon><Download /></el-icon>
|
||||
导出
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="getList"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -100,9 +128,11 @@
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('productNo')"
|
||||
prop="productNo"
|
||||
label="产品编号"
|
||||
min-width="130"
|
||||
@@ -140,6 +170,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('categoryName')"
|
||||
prop="categoryName"
|
||||
label="产品分类"
|
||||
min-width="120"
|
||||
@@ -148,6 +179,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('model')"
|
||||
prop="model"
|
||||
label="规格型号"
|
||||
min-width="120"
|
||||
@@ -156,6 +188,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('unit')"
|
||||
prop="unit"
|
||||
label="单位"
|
||||
min-width="80"
|
||||
@@ -167,6 +200,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('price')"
|
||||
prop="price"
|
||||
label="标准价(元)"
|
||||
min-width="120"
|
||||
@@ -178,6 +212,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('cost')"
|
||||
prop="cost"
|
||||
label="成本价(元)"
|
||||
min-width="120"
|
||||
@@ -189,6 +224,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('status')"
|
||||
prop="status"
|
||||
label="状态"
|
||||
min-width="80"
|
||||
@@ -204,36 +240,6 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="160"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button class="btn-op-item primary" @click="handleUpdate(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-dropdown trigger="hover" @command="(cmd: string) => handleMoreCommand(cmd, row)">
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="view">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -403,6 +409,22 @@
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
>
|
||||
<template #hero-actions>
|
||||
<div class="product-view-hero-actions">
|
||||
<el-button class="btn-main" type="primary" @click="handleDetailEdit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(detailData)"
|
||||
:title="canDeleteByCreator(detailData) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDetailDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template #images>
|
||||
<div v-if="productImageList.length" class="product-images">
|
||||
<ImagePreview
|
||||
@@ -470,6 +492,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { FormInstance, UploadFile } from 'element-plus'
|
||||
import {
|
||||
Plus,
|
||||
Edit,
|
||||
Delete,
|
||||
Close,
|
||||
Check,
|
||||
@@ -477,8 +500,6 @@ import {
|
||||
RefreshLeft,
|
||||
Download,
|
||||
Upload,
|
||||
View,
|
||||
More,
|
||||
Top,
|
||||
Bottom,
|
||||
Box
|
||||
@@ -490,8 +511,15 @@ import SystemViewDialog, {
|
||||
import { crmDictField, crmField, crmLongField, crmTagField } from '@/utils/crm/view-fields'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import {
|
||||
canDeleteByCreator,
|
||||
filterDeletableByCreator,
|
||||
allRowsDeletableByCreator,
|
||||
CREATOR_DELETE_TIP
|
||||
} from '@/utils/creator-delete'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import {
|
||||
fetchCategoryTree,
|
||||
fetchProductList,
|
||||
@@ -519,8 +547,27 @@ function getHazardFlagTagType(value: unknown) {
|
||||
const productList = ref<any[]>([])
|
||||
const categoryOptions = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'productNo', label: '产品编号' },
|
||||
{ prop: 'categoryName', label: '产品分类' },
|
||||
{ prop: 'model', label: '规格型号' },
|
||||
{ prop: 'unit', label: '单位' },
|
||||
{ prop: 'price', label: '标准价(元)' },
|
||||
{ prop: 'cost', label: '成本价(元)', defaultVisible: false },
|
||||
{ prop: 'status', label: '状态' }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('crm-product-list-columns', listColumnDefs)
|
||||
|
||||
const selectedRows = ref<any[]>([])
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
const searchForm = reactive({
|
||||
keyword: '',
|
||||
@@ -691,6 +738,25 @@ function handleAdd() {
|
||||
formDialogVisible.value = true
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条数据进行编辑')
|
||||
return
|
||||
}
|
||||
handleUpdate(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDetailEdit() {
|
||||
if (!detailData.value) return
|
||||
await handleUpdate(detailData.value)
|
||||
}
|
||||
|
||||
async function handleDetailDelete() {
|
||||
if (!detailData.value) return
|
||||
await handleDelete(detailData.value)
|
||||
detailDialogVisible.value = false
|
||||
}
|
||||
|
||||
async function handleUpdate(row: any) {
|
||||
isEdit.value = true
|
||||
resetFormData()
|
||||
@@ -726,11 +792,6 @@ async function handleView(row: any) {
|
||||
detailDialogVisible.value = true
|
||||
}
|
||||
|
||||
function handleMoreCommand(cmd: string, row: any) {
|
||||
if (cmd === 'view') handleView(row)
|
||||
else if (cmd === 'delete') handleDelete(row)
|
||||
}
|
||||
|
||||
async function handleDelete(row?: any) {
|
||||
if (!row && selectedRows.value.length === 0) {
|
||||
ElMessage.warning('请至少选择一条数据进行删除')
|
||||
@@ -816,6 +877,10 @@ async function submitForm() {
|
||||
}
|
||||
formDialogVisible.value = false
|
||||
await getList()
|
||||
if (detailDialogVisible.value && formData.id) {
|
||||
const res = await fetchProductDetail({ id: formData.id })
|
||||
detailData.value = (res as any)?.data || res || null
|
||||
}
|
||||
} finally {
|
||||
submitLoading.value = false
|
||||
}
|
||||
@@ -958,4 +1023,12 @@ onMounted(() => {
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.product-view-hero-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -171,7 +171,7 @@ watch(dialogVisible, (val) => {
|
||||
// 查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
productName: undefined,
|
||||
categoryId: undefined,
|
||||
status: 'on' // on-上架 off-下架
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<p v-if="quote?.quoteNo" class="detail-subtitle">{{ quote.quoteNo }} — {{ quote.quoteTitle }}</p>
|
||||
|
||||
<el-tabs v-model="activeTab" class="panel-tabs">
|
||||
<el-tabs v-model="activeTab" class="panel-pill-tabs panel-pill-tabs--lg">
|
||||
<!-- 基本信息 -->
|
||||
<el-tab-pane label="基本信息" name="basic">
|
||||
<el-descriptions :column="2" border>
|
||||
|
||||
@@ -5,14 +5,16 @@
|
||||
<h2 class="title-bar-heading">报价单管理</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-tabs">
|
||||
<el-tabs v-model="activeView" @tab-change="handleViewChange">
|
||||
<el-tab-pane label="我的报价" name="my" />
|
||||
<el-tab-pane label="全部报价" name="all" />
|
||||
<el-tab-pane label="待审批" name="submitted" />
|
||||
<el-tab-pane label="已审批" name="accepted" />
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-tabs
|
||||
v-model="activeView"
|
||||
class="panel-pill-tabs panel-pill-tabs--lg"
|
||||
@tab-change="handleViewChange"
|
||||
>
|
||||
<el-tab-pane label="我的报价" name="my" />
|
||||
<el-tab-pane label="全部报价" name="all" />
|
||||
<el-tab-pane label="待审批" name="submitted" />
|
||||
<el-tab-pane label="已审批" name="accepted" />
|
||||
</el-tabs>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form ref="queryFormRef" :model="queryParams" class="filter-form" @submit.prevent>
|
||||
@@ -139,6 +141,24 @@
|
||||
<el-button v-if="hasQuotePerm('add')" class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasQuotePerm('edit')"
|
||||
class="btn-ghost"
|
||||
:disabled="single || selectedRows[0]?.status !== 'draft'"
|
||||
@click="handleUpdate()"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasQuotePerm('remove')"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="single || selectedRows[0]?.status !== 'draft' || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="canDeleteByCreator(selectedRows[0]) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete()"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button v-if="hasQuotePerm('add')" class="btn-ghost" :disabled="single" @click="handleCopyAdd()">
|
||||
<el-icon><DocumentCopy /></el-icon>复制新增
|
||||
</el-button>
|
||||
@@ -164,12 +184,16 @@
|
||||
<el-button v-if="hasQuotePerm('edit')" class="btn-ghost" :disabled="multiple" @click="handleInvalid()">
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleColumnSetting">
|
||||
<el-icon><Setting /></el-icon>列设置
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loading" @click="getList">
|
||||
<el-icon><Refresh /></el-icon>刷新
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="getList"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -399,23 +423,6 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column v-if="isColumnVisible('remark')" label="备注" align="center" prop="remark" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column label="操作" min-width="260" align="center" header-align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button v-if="hasQuotePerm('query')" class="btn-op-item" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hasQuotePerm('edit')"
|
||||
class="btn-op-item primary"
|
||||
:disabled="row.status !== 'draft'"
|
||||
@click="handleUpdate(row)"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -714,38 +721,6 @@
|
||||
@edit="handleEditFromDetail"
|
||||
/>
|
||||
|
||||
<!-- 列设置对话框 -->
|
||||
<el-dialog
|
||||
v-model="columnSettingDialog.visible"
|
||||
title="列设置"
|
||||
width="600px"
|
||||
align-center
|
||||
append-to-body
|
||||
class="dialog-form-layout"
|
||||
modal-class="order-module-dialog-mask"
|
||||
>
|
||||
<div class="column-setting-content">
|
||||
<el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">全选</el-checkbox>
|
||||
<el-divider />
|
||||
<el-checkbox-group v-model="visibleColumns" @change="handleCheckedColumnsChange">
|
||||
<div v-for="col in tableColumns" :key="col.prop" class="column-item">
|
||||
<el-checkbox :label="col.prop" :disabled="col.fixed">{{ col.label }}</el-checkbox>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button class="btn-ghost" @click="handleResetColumns">
|
||||
<el-icon><RefreshLeft /></el-icon>恢复默认
|
||||
</el-button>
|
||||
<el-button @click="columnSettingDialog.visible = false">
|
||||
<el-icon><Close /></el-icon>取消
|
||||
</el-button>
|
||||
<el-button type="primary" @click="handleSaveColumnSetting">
|
||||
<el-icon><Check /></el-icon>保存
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<QuoteFormDialog ref="quoteFormDialogRef" @success="getList" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -767,12 +742,9 @@ import {
|
||||
Edit,
|
||||
Plus,
|
||||
Printer,
|
||||
Refresh,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
Select,
|
||||
Setting,
|
||||
View
|
||||
Select
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
const dictStore = useDictStore()
|
||||
@@ -816,9 +788,11 @@ import html2canvas from 'html2canvas';
|
||||
import jsPDF from 'jspdf';
|
||||
|
||||
import { useQuotePerm } from '@/hooks/business/useQuotePerm'
|
||||
import { filterDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { filterDeletableByCreator, canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import QuoteFormDialog from './components/QuoteFormDialog.vue'
|
||||
import QuoteDetailDialog from './components/QuoteDetailDialog.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
|
||||
const { loadPerms, hasQuotePerm } = useQuotePerm()
|
||||
const router = useRouter()
|
||||
@@ -874,117 +848,55 @@ const getApprovalTimelineColor = (result?: string) => {
|
||||
return '#94a3b8';
|
||||
};
|
||||
|
||||
// 列配置相关
|
||||
const COLUMN_STORAGE_KEY = 'crm_quote_visible_columns';
|
||||
// 列配置
|
||||
const listColumnDefs = [
|
||||
{ prop: 'quoteType', label: '报价类型' },
|
||||
{ prop: 'customerName', label: '客户名称' },
|
||||
{ prop: 'opportunityName', label: '商机名称' },
|
||||
{ prop: 'contactName', label: '联系人' },
|
||||
{ prop: 'contactMobile', label: '联系人手机' },
|
||||
{ prop: 'contactEmail', label: '联系人邮箱' },
|
||||
{ prop: 'version', label: '版本号' },
|
||||
{ prop: 'totalAmount', label: '总金额' },
|
||||
{ prop: 'discountRate', label: '折扣率' },
|
||||
{ prop: 'discountAmount', label: '折扣金额' },
|
||||
{ prop: 'finalAmount', label: '最终金额' },
|
||||
{ prop: 'status', label: '状态' },
|
||||
{ prop: 'validityDays', label: '有效期' },
|
||||
{ prop: 'quoteDate', label: '报价日期' },
|
||||
{ prop: 'expireDate', label: '到期日期' },
|
||||
{ prop: 'rejectReason', label: '拒绝原因' },
|
||||
{ prop: 'viewCount', label: '查看次数' },
|
||||
{ prop: 'lastViewTime', label: '最后查看时间' },
|
||||
{ prop: 'ownerUserName', label: '负责人' },
|
||||
{ prop: 'paymentTerms', label: '付款条款' },
|
||||
{ prop: 'deliveryTerms', label: '交付条款' },
|
||||
{ prop: 'createDeptName', label: '创建部门' },
|
||||
{ prop: 'createByName', label: '创建人' },
|
||||
{ prop: 'createTime', label: '创建时间' },
|
||||
{ prop: 'updateByName', label: '更新人' },
|
||||
{ prop: 'updateTime', label: '更新时间' },
|
||||
{ prop: 'remark', label: '备注' }
|
||||
]
|
||||
|
||||
// 定义所有列配置(顺序代表显示顺序)
|
||||
const tableColumns = ref([
|
||||
{ prop: 'quoteType', label: '报价类型', fixed: false },
|
||||
{ prop: 'customerName', label: '客户名称', fixed: false },
|
||||
{ prop: 'opportunityName', label: '商机名称', fixed: false },
|
||||
{ prop: 'contactName', label: '联系人', fixed: false },
|
||||
{ prop: 'contactMobile', label: '联系人手机', fixed: false },
|
||||
{ prop: 'contactEmail', label: '联系人邮箱', fixed: false },
|
||||
{ prop: 'version', label: '版本号', fixed: false },
|
||||
{ prop: 'totalAmount', label: '总金额', fixed: false },
|
||||
{ prop: 'discountRate', label: '折扣率', fixed: false },
|
||||
{ prop: 'discountAmount', label: '折扣金额', fixed: false },
|
||||
{ prop: 'finalAmount', label: '最终金额', fixed: false },
|
||||
{ prop: 'status', label: '状态', fixed: false },
|
||||
{ prop: 'validityDays', label: '有效期', fixed: false },
|
||||
{ prop: 'quoteDate', label: '报价日期', fixed: false },
|
||||
{ prop: 'expireDate', label: '到期日期', fixed: false },
|
||||
{ prop: 'rejectReason', label: '拒绝原因', fixed: false },
|
||||
{ prop: 'viewCount', label: '查看次数', fixed: false },
|
||||
{ prop: 'lastViewTime', label: '最后查看时间', fixed: false },
|
||||
{ prop: 'ownerUserName', label: '负责人', fixed: false },
|
||||
{ prop: 'paymentTerms', label: '付款条款', fixed: false },
|
||||
{ prop: 'deliveryTerms', label: '交付条款', fixed: false },
|
||||
{ prop: 'createDeptName', label: '创建部门', fixed: false },
|
||||
{ prop: 'createByName', label: '创建人', fixed: false },
|
||||
{ prop: 'createTime', label: '创建时间', fixed: false },
|
||||
{ prop: 'updateByName', label: '更新人', fixed: false },
|
||||
{ prop: 'updateTime', label: '更新时间', fixed: false },
|
||||
{ prop: 'remark', label: '备注', fixed: false }
|
||||
]);
|
||||
|
||||
// 默认显示的列(现有字段)
|
||||
const defaultVisibleColumns = ['quoteType', 'customerName', 'finalAmount', 'status', 'validityDays', 'ownerUserName', 'quoteDate', 'createTime'];
|
||||
|
||||
// 当前显示的列
|
||||
const visibleColumns = ref<string[]>([]);
|
||||
|
||||
// 列设置对话框
|
||||
const columnSettingDialog = reactive({
|
||||
visible: false
|
||||
});
|
||||
|
||||
// 全选状态
|
||||
const checkAll = ref(false);
|
||||
const isIndeterminate = ref(false);
|
||||
|
||||
/** 初始化列配置 */
|
||||
const initColumnSetting = () => {
|
||||
const savedColumns = localStorage.getItem(COLUMN_STORAGE_KEY);
|
||||
if (savedColumns) {
|
||||
try {
|
||||
visibleColumns.value = JSON.parse(savedColumns);
|
||||
} catch (error) {
|
||||
console.error('解析列配置失败:', error);
|
||||
visibleColumns.value = [...defaultVisibleColumns];
|
||||
}
|
||||
} else {
|
||||
visibleColumns.value = [...defaultVisibleColumns];
|
||||
}
|
||||
updateCheckAllStatus();
|
||||
};
|
||||
|
||||
/** 判断列是否显示 */
|
||||
const isColumnVisible = (prop: string) => {
|
||||
return visibleColumns.value.includes(prop);
|
||||
};
|
||||
|
||||
/** 打开列设置对话框 */
|
||||
const handleColumnSetting = () => {
|
||||
columnSettingDialog.visible = true;
|
||||
};
|
||||
|
||||
/** 全选/取消全选 */
|
||||
const handleCheckAllChange = (val: boolean) => {
|
||||
visibleColumns.value = val ? tableColumns.value.map((col) => col.prop) : [];
|
||||
isIndeterminate.value = false;
|
||||
};
|
||||
|
||||
/** 列选择变化 */
|
||||
const handleCheckedColumnsChange = () => {
|
||||
updateCheckAllStatus();
|
||||
};
|
||||
|
||||
/** 更新全选状态 */
|
||||
const updateCheckAllStatus = () => {
|
||||
const checkedCount = visibleColumns.value.length;
|
||||
const totalCount = tableColumns.value.length;
|
||||
checkAll.value = checkedCount === totalCount;
|
||||
isIndeterminate.value = checkedCount > 0 && checkedCount < totalCount;
|
||||
};
|
||||
|
||||
/** 恢复默认列设置 */
|
||||
const handleResetColumns = () => {
|
||||
visibleColumns.value = [...defaultVisibleColumns];
|
||||
updateCheckAllStatus();
|
||||
};
|
||||
|
||||
/** 保存列设置 */
|
||||
const handleSaveColumnSetting = () => {
|
||||
try {
|
||||
localStorage.setItem(COLUMN_STORAGE_KEY, JSON.stringify(visibleColumns.value));
|
||||
$modal.msgSuccess('列设置保存成功');
|
||||
columnSettingDialog.visible = false;
|
||||
} catch (error) {
|
||||
console.error('保存列配置失败:', error);
|
||||
$modal.msgError('保存列设置失败');
|
||||
}
|
||||
};
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('crm_quote_visible_columns', listColumnDefs, {
|
||||
defaultVisibleProps: [
|
||||
'quoteType',
|
||||
'customerName',
|
||||
'finalAmount',
|
||||
'status',
|
||||
'validityDays',
|
||||
'ownerUserName',
|
||||
'quoteDate',
|
||||
'createTime'
|
||||
]
|
||||
})
|
||||
|
||||
type QuoteViewName = 'my' | 'all' | 'submitted' | 'accepted'
|
||||
|
||||
@@ -998,7 +910,7 @@ interface TabFilterState {
|
||||
const createDefaultTabFilter = (): TabFilterState => ({
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
keyword: undefined,
|
||||
quoteNo: undefined,
|
||||
quoteTitle: undefined,
|
||||
@@ -1023,7 +935,7 @@ const tabFilterMap = reactive<Record<QuoteViewName, TabFilterState>>({
|
||||
// 查询参数(当前 tab 的检索条件)
|
||||
const queryParams = ref<QuoteQuery>({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
keyword: undefined,
|
||||
quoteNo: undefined,
|
||||
quoteTitle: undefined,
|
||||
@@ -2514,7 +2426,6 @@ watchDebounced(
|
||||
|
||||
onMounted(() => {
|
||||
loadPerms()
|
||||
initColumnSetting();
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
@@ -2780,25 +2691,6 @@ onMounted(() => {
|
||||
min-height: 32px !important;
|
||||
}
|
||||
|
||||
/* 列设置对话框样式 */
|
||||
.column-setting-content {
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
|
||||
.column-item {
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
:deep(.el-checkbox) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.quote-product-expand {
|
||||
padding: 12px 16px;
|
||||
background-color: var(--mint-table-head, #f8fafc);
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
<!-- 精简工作台:无业务统计接口,仅作入口与 UI 规范说明 -->
|
||||
<!-- Demo 工作台:Fresh Mint 模板页入口 -->
|
||||
<template>
|
||||
<div class="console-container console-lite">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>快速入口</h2>
|
||||
<h2 class="title-bar-heading">Demo 模板页</h2>
|
||||
</div>
|
||||
<div class="console-lite__body">
|
||||
<p class="console-lite__hint"
|
||||
>详见仓库根目录 `.cursorrules` 中「页面级 UI 模板(固定五页)」。</p
|
||||
>
|
||||
<p class="console-lite__hint">
|
||||
以下页面为 Fresh Mint UI 参考模板,数据为本地 Mock,不影响业务模块。详见
|
||||
<code>docs/web-admin-ui-spec-fresh-mint.md</code> 与
|
||||
<code>docs/web-admin-ui-pattern-index.md</code>。
|
||||
</p>
|
||||
<div class="console-lite__links">
|
||||
<el-button
|
||||
v-for="item in links"
|
||||
@@ -17,6 +19,7 @@
|
||||
type="primary"
|
||||
@click="go(item.path)"
|
||||
>
|
||||
<el-icon><Link /></el-icon>
|
||||
{{ item.label }}
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -27,17 +30,18 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRouter } from 'vue-router'
|
||||
import { Link } from '@element-plus/icons-vue'
|
||||
|
||||
defineOptions({ name: 'Console' })
|
||||
defineOptions({ name: 'DemoConsole' })
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const links = [
|
||||
{ label: '商品单位', path: '/system/unit' },
|
||||
{ label: '用户管理', path: '/system/user' },
|
||||
{ label: '商品分类', path: '/system/category' },
|
||||
{ label: '租户管理', path: '/system/tenant' },
|
||||
{ label: '客户管理', path: '/basic-info/customer' }
|
||||
{ label: '标准列表(单位)', path: '/demo/unit' },
|
||||
{ label: '复杂列表(订单)', path: '/demo/order' },
|
||||
{ label: '商品列表', path: '/demo/product' },
|
||||
{ label: '树形主数据(分类)', path: '/demo/category' },
|
||||
{ label: '用户 CRUD', path: '/demo/user' }
|
||||
]
|
||||
|
||||
const go = (path: string) => {
|
||||
@@ -54,12 +58,22 @@
|
||||
margin: 0 0 16px;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: #1e293b;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
|
||||
code {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.console-lite__links {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
|
||||
.el-button {
|
||||
:deep(.el-icon) {
|
||||
margin-right: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -139,14 +139,65 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增记录
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedRows.length === 1 && selectedRows[0]?.purchasePlanId"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows[0]?.hasWeighingSlip"
|
||||
@click="handleGenerateWeighing(selectedRows[0])"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
{{ selectedRows[0]?.hasWeighingSlip ? '已生成地磅单' : '生成地磅单' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedRows.length === 1 && selectedRows[0]?.purchasePlanId"
|
||||
class="btn-ghost"
|
||||
@click="handleCopyFillLink(selectedRows[0])"
|
||||
>
|
||||
<el-icon><Link /></el-icon>
|
||||
磅单二维码
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="
|
||||
selectedRows.length !== 1 ||
|
||||
!canDeleteRecord(selectedRows[0]) ||
|
||||
!canDeleteByCreator(selectedRows[0])
|
||||
"
|
||||
:title="
|
||||
selectedRows.length === 1 && !canDeleteRecord(selectedRows[0])
|
||||
? '仅支持删除当天及之后日期的记录'
|
||||
: selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0])
|
||||
? CREATOR_DELETE_TIP
|
||||
: ''
|
||||
"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="exportLoading" @click="handleExport">
|
||||
<el-icon><Download /></el-icon>
|
||||
导出 Excel
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loading" @click="loadData">
|
||||
<el-icon><Refresh /></el-icon>
|
||||
刷新
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="loadData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -161,10 +212,12 @@
|
||||
:summary-method="getSummary"
|
||||
@sort-change="handleSortChange"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="60" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('id')"
|
||||
prop="id"
|
||||
label="ID"
|
||||
min-width="100"
|
||||
@@ -175,6 +228,7 @@
|
||||
:sort-order="getSortOrder('id')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('planNo')"
|
||||
prop="planNo"
|
||||
label="计划号"
|
||||
min-width="140"
|
||||
@@ -189,8 +243,13 @@
|
||||
show-overflow-tooltip
|
||||
sortable="custom"
|
||||
:sort-order="getSortOrder('batchNo')"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.batchNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('date')"
|
||||
prop="date"
|
||||
label="日期"
|
||||
min-width="120"
|
||||
@@ -198,6 +257,7 @@
|
||||
:sort-order="getSortOrder('date')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('partnerCompany')"
|
||||
prop="partnerCompany"
|
||||
label="往来单位"
|
||||
min-width="150"
|
||||
@@ -206,6 +266,7 @@
|
||||
:sort-order="getSortOrder('partnerCompany')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('businessType')"
|
||||
prop="businessType"
|
||||
label="业务类型"
|
||||
min-width="100"
|
||||
@@ -219,6 +280,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('status')"
|
||||
prop="status"
|
||||
label="状态"
|
||||
min-width="110"
|
||||
@@ -232,6 +294,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('product')"
|
||||
prop="product"
|
||||
label="产品"
|
||||
min-width="120"
|
||||
@@ -240,6 +303,7 @@
|
||||
:sort-order="getSortOrder('product')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('specification')"
|
||||
prop="specification"
|
||||
label="规格"
|
||||
min-width="120"
|
||||
@@ -248,6 +312,7 @@
|
||||
:sort-order="getSortOrder('specification')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('vehicleNo')"
|
||||
prop="vehicleNo"
|
||||
label="车牌号"
|
||||
min-width="120"
|
||||
@@ -255,6 +320,7 @@
|
||||
:sort-order="getSortOrder('vehicleNo')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('quantity')"
|
||||
prop="quantity"
|
||||
label="数量(吨)"
|
||||
min-width="110"
|
||||
@@ -262,6 +328,7 @@
|
||||
:sort-order="getSortOrder('quantity')"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('netWeight')"
|
||||
prop="netWeight"
|
||||
label="净重(吨)"
|
||||
min-width="110"
|
||||
@@ -273,6 +340,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('grossWeight')"
|
||||
prop="grossWeight"
|
||||
label="毛重(吨)"
|
||||
min-width="110"
|
||||
@@ -284,6 +352,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('grossWeightTime')"
|
||||
prop="grossWeightTime"
|
||||
label="毛重时间"
|
||||
min-width="160"
|
||||
@@ -295,6 +364,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('tareWeight')"
|
||||
prop="tareWeight"
|
||||
label="皮重(吨)"
|
||||
min-width="110"
|
||||
@@ -306,6 +376,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('tareWeightTime')"
|
||||
prop="tareWeightTime"
|
||||
label="皮重时间"
|
||||
min-width="160"
|
||||
@@ -317,6 +388,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('deduction')"
|
||||
prop="deduction"
|
||||
label="扣杂(吨)"
|
||||
min-width="110"
|
||||
@@ -328,6 +400,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('remarks')"
|
||||
prop="remarks"
|
||||
label="备注"
|
||||
min-width="150"
|
||||
@@ -335,52 +408,6 @@
|
||||
sortable="custom"
|
||||
:sort-order="getSortOrder('remarks')"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="520"
|
||||
align="center"
|
||||
header-align="center"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div class="db-op-actions">
|
||||
<el-button class="btn-op-item" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button class="btn-op-item primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.purchasePlanId"
|
||||
class="btn-op-item"
|
||||
:disabled="row.hasWeighingSlip"
|
||||
@click="handleGenerateWeighing(row)"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
{{ row.hasWeighingSlip ? '已生成地磅单' : '生成地磅单' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.purchasePlanId"
|
||||
class="btn-op-item"
|
||||
@click="handleCopyFillLink(row)"
|
||||
>
|
||||
<el-icon><Link /></el-icon>
|
||||
磅单二维码
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item danger"
|
||||
:disabled="!canDeleteRecord(row) || !canDeleteByCreator(row)"
|
||||
:title="!canDeleteRecord(row) ? '仅支持删除当天及之后日期的记录' : canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -485,7 +512,47 @@
|
||||
v-model:visible="relatedModalOpen"
|
||||
:loading="loadingRelated"
|
||||
:data="relatedData"
|
||||
/>
|
||||
>
|
||||
<template v-if="viewingRecord" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRecord)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingRecord.purchasePlanId"
|
||||
class="btn-ghost"
|
||||
:disabled="viewingRecord.hasWeighingSlip"
|
||||
@click="handleGenerateWeighing(viewingRecord)"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
{{ viewingRecord.hasWeighingSlip ? '已生成地磅单' : '生成地磅单' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingRecord.purchasePlanId"
|
||||
class="btn-ghost"
|
||||
@click="handleCopyFillLink(viewingRecord)"
|
||||
>
|
||||
<el-icon><Link /></el-icon>
|
||||
磅单二维码
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteRecord(viewingRecord) || !canDeleteByCreator(viewingRecord)"
|
||||
:title="
|
||||
!canDeleteRecord(viewingRecord)
|
||||
? '仅支持删除当天及之后日期的记录'
|
||||
: canDeleteByCreator(viewingRecord)
|
||||
? ''
|
||||
: CREATOR_DELETE_TIP
|
||||
"
|
||||
@click="handleViewDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</DbInventoryRelatedViewDialog>
|
||||
|
||||
<DbPoundSlipQrcodeDialog v-model:visible="qrcodeModalOpen" :inventory-id="qrcodeInventoryId" />
|
||||
</div>
|
||||
@@ -508,12 +575,12 @@
|
||||
Edit,
|
||||
Link,
|
||||
Plus,
|
||||
Refresh,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
View
|
||||
} from '@element-plus/icons-vue'
|
||||
import DbCrmCustomerSelect from '@/components/business/db/DbCrmCustomerSelect.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import DbCrmProductSelect from '@/components/business/db/DbCrmProductSelect.vue'
|
||||
import DbInventoryRelatedViewDialog from '@/components/business/db/DbInventoryRelatedViewDialog.vue'
|
||||
@@ -535,13 +602,42 @@
|
||||
const router = useRouter()
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'id', label: 'ID', defaultVisible: false },
|
||||
{ prop: 'planNo', label: '计划号' },
|
||||
{ prop: 'date', label: '日期' },
|
||||
{ prop: 'partnerCompany', label: '往来单位' },
|
||||
{ prop: 'businessType', label: '业务类型' },
|
||||
{ prop: 'status', label: '状态' },
|
||||
{ prop: 'product', label: '产品' },
|
||||
{ prop: 'specification', label: '规格' },
|
||||
{ prop: 'vehicleNo', label: '车牌号' },
|
||||
{ prop: 'quantity', label: '数量(吨)' },
|
||||
{ prop: 'netWeight', label: '净重(吨)' },
|
||||
{ prop: 'grossWeight', label: '毛重(吨)' },
|
||||
{ prop: 'grossWeightTime', label: '毛重时间' },
|
||||
{ prop: 'tareWeight', label: '皮重(吨)' },
|
||||
{ prop: 'tareWeightTime', label: '皮重时间' },
|
||||
{ prop: 'deduction', label: '扣杂(吨)' },
|
||||
{ prop: 'remarks', label: '备注' }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('db-inventory-list-columns', listColumnDefs)
|
||||
|
||||
const exportLoading = ref(false)
|
||||
const saving = ref(false)
|
||||
const tableData = ref<InventoryRecord[]>([])
|
||||
const allRecords = ref<InventoryRecord[]>([])
|
||||
const total = ref(0)
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const pageSize = ref(20)
|
||||
const activeDateShortcut = ref<'all' | 'today' | 'tomorrow' | 'yesterday' | 'week' | ''>('today')
|
||||
const searchKeyword = ref('')
|
||||
const selectedRows = ref<InventoryRecord[]>([])
|
||||
@@ -559,6 +655,7 @@
|
||||
const relatedModalOpen = ref(false)
|
||||
const loadingRelated = ref(false)
|
||||
const relatedData = ref<InventoryRelatedData>({ plan: null, weighing: null })
|
||||
const viewingRecord = ref<InventoryRecord | null>(null)
|
||||
|
||||
const filters = reactive({
|
||||
batchNo: '',
|
||||
@@ -845,6 +942,7 @@
|
||||
}
|
||||
|
||||
const handleView = async (record: InventoryRecord) => {
|
||||
viewingRecord.value = record
|
||||
loadingRelated.value = true
|
||||
try {
|
||||
relatedData.value = await inventoryApi.getRelated(record.id)
|
||||
@@ -856,6 +954,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条记录')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条记录')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleViewDelete() {
|
||||
if (!viewingRecord.value) return
|
||||
await handleDelete(viewingRecord.value)
|
||||
relatedModalOpen.value = false
|
||||
}
|
||||
|
||||
const handleEdit = (record: InventoryRecord) => {
|
||||
editingRecord.value = record
|
||||
Object.assign(formData, {
|
||||
|
||||
@@ -135,14 +135,46 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增计划
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarGenerateInventory"
|
||||
>
|
||||
<el-icon><DocumentAdd /></el-icon>
|
||||
生成出入库单
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="exportLoading" @click="handleExport">
|
||||
<el-icon><Download /></el-icon>
|
||||
导出 Excel
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loading" @click="loadData">
|
||||
<el-icon><Refresh /></el-icon>
|
||||
刷新
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="loadData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -156,6 +188,7 @@
|
||||
show-summary
|
||||
:summary-method="getSummary"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="60" align="center" header-align="center" />
|
||||
@@ -166,8 +199,13 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.planNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('businessType')"
|
||||
prop="businessType"
|
||||
label="业务类型"
|
||||
min-width="100"
|
||||
@@ -181,6 +219,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('customerName')"
|
||||
prop="customerName"
|
||||
label="往来单位"
|
||||
min-width="150"
|
||||
@@ -189,6 +228,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('startDate')"
|
||||
prop="startDate"
|
||||
label="起始日期"
|
||||
min-width="120"
|
||||
@@ -196,6 +236,7 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('endDate')"
|
||||
prop="endDate"
|
||||
label="截止日期"
|
||||
min-width="120"
|
||||
@@ -203,6 +244,7 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('product')"
|
||||
prop="product"
|
||||
label="产品"
|
||||
min-width="120"
|
||||
@@ -211,6 +253,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('specification')"
|
||||
prop="specification"
|
||||
label="规格"
|
||||
min-width="120"
|
||||
@@ -219,18 +262,26 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('plannedQuantity')"
|
||||
label="计划量(吨)"
|
||||
prop="plannedQuantity"
|
||||
min-width="120"
|
||||
align="right"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column label="已执行量(吨)" min-width="130" align="right" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('executedQuantity')"
|
||||
label="已执行量(吨)"
|
||||
min-width="130"
|
||||
align="right"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ ((row.executedQuantity || 0) / 1000).toFixed(2) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('executionStatus')"
|
||||
prop="executionStatus"
|
||||
label="执行状态"
|
||||
min-width="120"
|
||||
@@ -244,6 +295,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('remarks')"
|
||||
prop="remarks"
|
||||
label="备注"
|
||||
min-width="150"
|
||||
@@ -251,7 +303,13 @@
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="自动生成" min-width="140" align="center" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('autoGenerate')"
|
||||
label="自动生成"
|
||||
min-width="140"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
v-model="row.autoGenerateEnabled"
|
||||
@@ -266,39 +324,6 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="360"
|
||||
align="center"
|
||||
header-align="center"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div class="db-op-actions">
|
||||
<el-button class="btn-op-item" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button class="btn-op-item primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="handleGenerateInventory(row)">
|
||||
<el-icon><DocumentAdd /></el-icon>
|
||||
生成出入库单
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item danger"
|
||||
:disabled="!canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -436,7 +461,28 @@
|
||||
v-model:visible="relatedModalOpen"
|
||||
:loading="loadingRelated"
|
||||
:data="relatedData"
|
||||
/>
|
||||
>
|
||||
<template v-if="viewingRecord" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRecord)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleGenerateInventory(viewingRecord)">
|
||||
<el-icon><DocumentAdd /></el-icon>
|
||||
生成出入库单
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewingRecord)"
|
||||
:title="canDeleteByCreator(viewingRecord) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleViewDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</DbPlanRelatedViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -454,12 +500,12 @@
|
||||
Download,
|
||||
Edit,
|
||||
Plus,
|
||||
Refresh,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
View
|
||||
} from '@element-plus/icons-vue'
|
||||
import DbCrmCustomerSelect from '@/components/business/db/DbCrmCustomerSelect.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import DbCrmProductSelect from '@/components/business/db/DbCrmProductSelect.vue'
|
||||
import DbPlanRelatedViewDialog from '@/components/business/db/DbPlanRelatedViewDialog.vue'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
@@ -478,13 +524,35 @@
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'businessType', label: '业务类型' },
|
||||
{ prop: 'customerName', label: '往来单位' },
|
||||
{ prop: 'startDate', label: '起始日期' },
|
||||
{ prop: 'endDate', label: '截止日期' },
|
||||
{ prop: 'product', label: '产品' },
|
||||
{ prop: 'specification', label: '规格' },
|
||||
{ prop: 'plannedQuantity', label: '计划量(吨)' },
|
||||
{ prop: 'executedQuantity', label: '已执行量(吨)' },
|
||||
{ prop: 'executionStatus', label: '执行状态' },
|
||||
{ prop: 'remarks', label: '备注' },
|
||||
{ prop: 'autoGenerate', label: '自动生成' }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('db-plans-list-columns', listColumnDefs)
|
||||
|
||||
const loading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const saving = ref(false)
|
||||
const tableData = ref<Plan[]>([])
|
||||
const total = ref(0)
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const pageSize = ref(20)
|
||||
const searchKeyword = ref('')
|
||||
const selectedRows = ref<Plan[]>([])
|
||||
const activeDateShortcut = ref<'all' | 'today' | 'tomorrow' | 'yesterday' | 'week' | ''>('')
|
||||
@@ -762,8 +830,10 @@
|
||||
})
|
||||
const relatedModalOpen = ref(false)
|
||||
const loadingRelated = ref(false)
|
||||
const viewingRecord = ref<Plan | null>(null)
|
||||
|
||||
const handleView = async (record: Plan) => {
|
||||
viewingRecord.value = record
|
||||
loadingRelated.value = true
|
||||
try {
|
||||
relatedData.value = await planApi.getRelated(record.id)
|
||||
@@ -775,6 +845,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条计划')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarGenerateInventory() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条计划')
|
||||
return
|
||||
}
|
||||
handleGenerateInventory(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条计划')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleViewDelete() {
|
||||
if (!viewingRecord.value) return
|
||||
await handleDelete(viewingRecord.value)
|
||||
relatedModalOpen.value = false
|
||||
}
|
||||
|
||||
const handleDelete = async (row: Plan) => {
|
||||
if (!canDeleteByCreator(row)) {
|
||||
$modal.msgWarning(CREATOR_DELETE_TIP)
|
||||
|
||||
@@ -137,14 +137,45 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增地磅单
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="
|
||||
selectedRows.length !== 1 ||
|
||||
selectedRows[0]?.isVoided === 1 ||
|
||||
!isWeighingRecordToday(selectedRows[0])
|
||||
"
|
||||
:title="
|
||||
selectedRows.length === 1 && !isWeighingRecordToday(selectedRows[0])
|
||||
? '仅支持作废当天的地磅单'
|
||||
: ''
|
||||
"
|
||||
@click="handleToolbarVoid"
|
||||
>
|
||||
<el-icon><Close /></el-icon>
|
||||
作废
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="exportLoading" @click="handleExport">
|
||||
<el-icon><Download /></el-icon>
|
||||
导出 Excel
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loading" @click="loadData">
|
||||
<el-icon><Refresh /></el-icon>
|
||||
刷新
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="loadData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -158,10 +189,12 @@
|
||||
show-summary
|
||||
:summary-method="getSummary"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column type="index" label="序号" min-width="60" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('inventoryDate')"
|
||||
prop="inventoryDate"
|
||||
label="日期"
|
||||
min-width="120"
|
||||
@@ -173,6 +206,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('planNo')"
|
||||
prop="planNo"
|
||||
label="计划单号"
|
||||
min-width="140"
|
||||
@@ -187,8 +221,13 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.batchNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('vehicleNo')"
|
||||
prop="vehicleNo"
|
||||
label="车牌号"
|
||||
min-width="120"
|
||||
@@ -196,6 +235,7 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('cargoName')"
|
||||
prop="cargoName"
|
||||
label="货物名称"
|
||||
min-width="150"
|
||||
@@ -204,6 +244,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('specification')"
|
||||
prop="specification"
|
||||
label="规格"
|
||||
min-width="120"
|
||||
@@ -212,6 +253,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('businessType')"
|
||||
prop="businessType"
|
||||
label="业务类型"
|
||||
min-width="100"
|
||||
@@ -224,7 +266,13 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单据状态" min-width="100" align="center" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('docStatus')"
|
||||
label="单据状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.isVoided === 1 ? 'danger' : 'success'" size="small">
|
||||
{{ row.isVoided === 1 ? '已作废' : '正常' }}
|
||||
@@ -232,6 +280,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('supplier')"
|
||||
prop="supplier"
|
||||
label="供货单位"
|
||||
min-width="150"
|
||||
@@ -240,6 +289,7 @@
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('consignee')"
|
||||
prop="consignee"
|
||||
label="收货单位"
|
||||
min-width="150"
|
||||
@@ -247,17 +297,30 @@
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="本次量(吨)" min-width="110" align="right" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('currentQuantity')"
|
||||
label="本次量(吨)"
|
||||
min-width="110"
|
||||
align="right"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatKgToTon(row.currentQuantity) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="净重(吨)" min-width="110" align="right" header-align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('netWeight')"
|
||||
label="净重(吨)"
|
||||
min-width="110"
|
||||
align="right"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatKgToTon(row.netWeight) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('grossWeight')"
|
||||
prop="grossWeight"
|
||||
label="毛重(kg)"
|
||||
min-width="110"
|
||||
@@ -265,6 +328,7 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('grossWeightTime')"
|
||||
prop="grossWeightTime"
|
||||
label="毛重时间"
|
||||
min-width="160"
|
||||
@@ -272,6 +336,7 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('tareWeight')"
|
||||
prop="tareWeight"
|
||||
label="皮重(kg)"
|
||||
min-width="110"
|
||||
@@ -279,45 +344,23 @@
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('tareWeightTime')"
|
||||
prop="tareWeightTime"
|
||||
label="皮重时间"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column prop="deduction" label="扣杂(kg)" min-width="110" align="right" header-align="center">
|
||||
<template #default="{ row }">
|
||||
{{ row.deduction || 0 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="280"
|
||||
align="center"
|
||||
v-if="isColumnVisible('deduction')"
|
||||
prop="deduction"
|
||||
label="扣杂(kg)"
|
||||
min-width="110"
|
||||
align="right"
|
||||
header-align="center"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div class="db-op-actions">
|
||||
<el-button class="btn-op-item" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button class="btn-op-item primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.isVoided === 0"
|
||||
class="btn-op-item op-warn"
|
||||
:disabled="!isWeighingRecordToday(row)"
|
||||
:title="isWeighingRecordToday(row) ? '' : '仅支持作废当天的地磅单'"
|
||||
@click="handleVoid(row)"
|
||||
>
|
||||
<el-icon><Close /></el-icon>
|
||||
作废
|
||||
</el-button>
|
||||
</div>
|
||||
{{ row.deduction || 0 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -477,7 +520,24 @@
|
||||
v-model:visible="relatedModalOpen"
|
||||
:loading="loadingRelated"
|
||||
:sections="relatedViewSections"
|
||||
/>
|
||||
>
|
||||
<template v-if="viewingRecord" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRecord)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingRecord.isVoided === 0"
|
||||
class="btn-ghost"
|
||||
:disabled="!isWeighingRecordToday(viewingRecord)"
|
||||
:title="isWeighingRecordToday(viewingRecord) ? '' : '仅支持作废当天的地磅单'"
|
||||
@click="handleViewVoid"
|
||||
>
|
||||
<el-icon><Close /></el-icon>
|
||||
作废
|
||||
</el-button>
|
||||
</template>
|
||||
</DbRelatedViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -495,12 +555,12 @@
|
||||
Download,
|
||||
Edit,
|
||||
Plus,
|
||||
Refresh,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
View
|
||||
} from '@element-plus/icons-vue'
|
||||
import DbCrmCustomerSelect from '@/components/business/db/DbCrmCustomerSelect.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import DbCrmProductSelect from '@/components/business/db/DbCrmProductSelect.vue'
|
||||
import DbRelatedViewDialog from '@/components/business/db/DbRelatedViewDialog.vue'
|
||||
import { buildWeighingRelatedSections } from '@/components/business/db/db-related-view'
|
||||
@@ -522,13 +582,40 @@
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'inventoryDate', label: '日期' },
|
||||
{ prop: 'planNo', label: '计划单号' },
|
||||
{ prop: 'vehicleNo', label: '车牌号' },
|
||||
{ prop: 'cargoName', label: '货物名称' },
|
||||
{ prop: 'specification', label: '规格' },
|
||||
{ prop: 'businessType', label: '业务类型' },
|
||||
{ prop: 'docStatus', label: '单据状态' },
|
||||
{ prop: 'supplier', label: '供货单位' },
|
||||
{ prop: 'consignee', label: '收货单位' },
|
||||
{ prop: 'currentQuantity', label: '本次量(吨)' },
|
||||
{ prop: 'netWeight', label: '净重(吨)' },
|
||||
{ prop: 'grossWeight', label: '毛重(kg)' },
|
||||
{ prop: 'grossWeightTime', label: '毛重时间' },
|
||||
{ prop: 'tareWeight', label: '皮重(kg)' },
|
||||
{ prop: 'tareWeightTime', label: '皮重时间' },
|
||||
{ prop: 'deduction', label: '扣杂(kg)' }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('db-weighing-list-columns', listColumnDefs)
|
||||
|
||||
const loading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const saving = ref(false)
|
||||
const allData = ref<WeighingRecord[]>([])
|
||||
const total = ref(0)
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const pageSize = ref(20)
|
||||
const searchKeyword = ref('')
|
||||
const selectedRows = ref<WeighingRecord[]>([])
|
||||
const activeDateShortcut = ref<'all' | 'today' | 'tomorrow' | 'yesterday' | 'week' | ''>('today')
|
||||
@@ -556,6 +643,7 @@
|
||||
const relatedModalOpen = ref(false)
|
||||
const loadingRelated = ref(false)
|
||||
const relatedData = ref<WeighingRelatedData>({ plan: null, inventory: null })
|
||||
const viewingRecord = ref<WeighingRecord | null>(null)
|
||||
|
||||
const relatedViewSections = computed(() => buildWeighingRelatedSections(relatedData.value))
|
||||
|
||||
@@ -836,6 +924,7 @@
|
||||
}
|
||||
|
||||
const handleView = async (record: WeighingRecord) => {
|
||||
viewingRecord.value = record
|
||||
loadingRelated.value = true
|
||||
try {
|
||||
relatedData.value = await weighingApi.getRelated(record.id)
|
||||
@@ -847,6 +936,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条地磅单')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarVoid() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
$modal.msgWarning('请先勾选一条地磅单')
|
||||
return
|
||||
}
|
||||
handleVoid(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleViewVoid() {
|
||||
if (!viewingRecord.value) return
|
||||
await handleVoid(viewingRecord.value)
|
||||
relatedModalOpen.value = false
|
||||
}
|
||||
|
||||
const handleEdit = (record: WeighingRecord) => {
|
||||
editingRecord.value = record
|
||||
Object.assign(formData, {
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,426 @@
|
||||
<!-- 物品单位管理 -->
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">单位列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form :model="searchForm" class="filter-form" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
<el-form-item label="关键词">
|
||||
<el-input v-model="searchForm.keyword" placeholder="单位名称/编码" clearable />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按名称、编码模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增单位
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length === 0"
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
批量删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="loadData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="tableData"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
min-width="68"
|
||||
align="center"
|
||||
header-align="center"
|
||||
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="unitName"
|
||||
label="单位名称"
|
||||
min-width="150"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.unitName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('unitCode')"
|
||||
prop="unitCode"
|
||||
label="单位编码"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('createTime')"
|
||||
prop="createTime"
|
||||
label="创建时间"
|
||||
min-width="180"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="120"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="edit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="delete" divided>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
:current-page="pagination.page"
|
||||
:page-size="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
|
||||
@current-change="(val) => ((pagination.page = val), loadData())"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="dialogTitle"
|
||||
width="560px"
|
||||
class="dialog-form-layout"
|
||||
align-center
|
||||
append-to-body
|
||||
modal-class="protocol-dialog-mask"
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-position="top"
|
||||
class="unit-dialog-form"
|
||||
scroll-to-error
|
||||
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
|
||||
>
|
||||
<div class="form-grid-2">
|
||||
<el-form-item label="单位名称" prop="unitName">
|
||||
<el-input v-model="formData.unitName" placeholder="如:斤、kg、个" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位编码" prop="unitCode">
|
||||
<el-input v-model="formData.unitCode" placeholder="如:jin、kg、ge" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="formData.remark" placeholder="可选" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button class="btn-ghost" @click="dialogVisible = false">
|
||||
<el-icon><Close /></el-icon>
|
||||
取消
|
||||
</el-button>
|
||||
<el-button class="btn-main" type="primary" @click="handleSubmit" :loading="submitLoading">
|
||||
<el-icon><Check /></el-icon>
|
||||
确定
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewVisible"
|
||||
:title="viewRow?.unitName || '单位详情'"
|
||||
:icon="ScaleToOriginal"
|
||||
:meta="viewRow?.createTime || ''"
|
||||
:sections="viewSections"
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
Plus,
|
||||
Close,
|
||||
Check,
|
||||
Edit,
|
||||
Delete,
|
||||
More,
|
||||
ScaleToOriginal,
|
||||
RefreshLeft,
|
||||
Search
|
||||
} from '@element-plus/icons-vue'
|
||||
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
|
||||
import {
|
||||
fetchItemUnitList,
|
||||
fetchCreateItemUnit,
|
||||
fetchUpdateItemUnit,
|
||||
fetchDeleteItemUnit
|
||||
} from '@/api/demo'
|
||||
|
||||
defineOptions({ name: 'SystemItemUnit' })
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'unitCode', label: '单位编码' },
|
||||
{ prop: 'createTime', label: '创建时间' }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('demo-unit-list-columns', listColumnDefs)
|
||||
|
||||
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
|
||||
const tableData = ref<Api.ItemUnit.ItemUnitItem[]>([])
|
||||
const selectedRows = ref<Api.ItemUnit.ItemUnitItem[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('新增单位')
|
||||
const isEdit = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const formRef = ref()
|
||||
const editingId = ref<string | null>(null)
|
||||
const viewVisible = ref(false)
|
||||
const viewRow = ref<Api.ItemUnit.ItemUnitItem | null>(null)
|
||||
|
||||
const formData = reactive({
|
||||
unitName: '',
|
||||
unitCode: '',
|
||||
orderNum: 0,
|
||||
remark: ''
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
unitName: [{ required: true, message: '请输入单位名称', trigger: 'blur' }],
|
||||
unitCode: [{ required: true, message: '请输入单位编码', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
const handleSelectionChange = (rows: Api.ItemUnit.ItemUnitItem[]) => {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
const viewSections = computed(() => {
|
||||
if (!viewRow.value) return []
|
||||
const row = viewRow.value
|
||||
return [
|
||||
{
|
||||
title: '基本信息',
|
||||
fields: [
|
||||
{ label: '单位名称', value: row.unitName },
|
||||
{ label: '单位编码', value: row.unitCode },
|
||||
{ label: '备注', value: row.remark, span: true }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await fetchItemUnitList({
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize,
|
||||
keyword: searchForm.keyword || undefined
|
||||
})
|
||||
tableData.value = res.list || []
|
||||
pagination.total = res.total ?? 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
searchForm.keyword = ''
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
formData.unitName = ''
|
||||
formData.unitCode = ''
|
||||
formData.orderNum = 0
|
||||
formData.remark = ''
|
||||
editingId.value = null
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
isEdit.value = false
|
||||
dialogTitle.value = '新增单位'
|
||||
resetForm()
|
||||
dialogVisible.value = true
|
||||
formRef.value?.clearValidate?.()
|
||||
}
|
||||
|
||||
function handleEdit(row: Api.ItemUnit.ItemUnitItem) {
|
||||
isEdit.value = true
|
||||
dialogTitle.value = '编辑单位'
|
||||
editingId.value = row.id
|
||||
formData.unitName = row.unitName || ''
|
||||
formData.unitCode = row.unitCode || ''
|
||||
formData.orderNum = row.orderNum ?? 0
|
||||
formData.remark = row.remark || ''
|
||||
dialogVisible.value = true
|
||||
formRef.value?.clearValidate?.()
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
await formRef.value?.validate?.()
|
||||
submitLoading.value = true
|
||||
try {
|
||||
const payload = {
|
||||
unitName: formData.unitName.trim(),
|
||||
unitCode: formData.unitCode.trim(),
|
||||
orderNum: formData.orderNum,
|
||||
remark: formData.remark?.trim() || undefined
|
||||
}
|
||||
if (isEdit.value && editingId.value) {
|
||||
await fetchUpdateItemUnit(editingId.value, payload)
|
||||
} else {
|
||||
await fetchCreateItemUnit(payload)
|
||||
}
|
||||
ElMessage.success(isEdit.value ? '更新成功' : '创建成功')
|
||||
dialogVisible.value = false
|
||||
await loadData()
|
||||
} catch {
|
||||
/* 校验或接口错误已由全局处理 */
|
||||
} finally {
|
||||
submitLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleView(row: Api.ItemUnit.ItemUnitItem) {
|
||||
viewRow.value = row
|
||||
viewVisible.value = true
|
||||
}
|
||||
|
||||
function handleDropdownCommand(command: string, row: any) {
|
||||
switch (command) {
|
||||
case 'edit':
|
||||
handleEdit(row)
|
||||
break
|
||||
case 'delete':
|
||||
handleDelete(row)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.ItemUnit.ItemUnitItem) {
|
||||
await ElMessageBox.confirm('确定要删除该单位吗?', '提示', { type: 'warning' })
|
||||
await fetchDeleteItemUnit(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
await loadData()
|
||||
}
|
||||
|
||||
async function handleBatchDelete() {
|
||||
const ids = selectedRows.value.map((r) => r.id)
|
||||
if (!ids.length) return
|
||||
await ElMessageBox.confirm(`确定删除选中的 ${ids.length} 个单位吗?`, '提示', {
|
||||
type: 'warning'
|
||||
})
|
||||
await withFullscreenLoading(async () => {
|
||||
for (const id of ids) {
|
||||
await fetchDeleteItemUnit(id)
|
||||
}
|
||||
ElMessage.success('批量删除成功')
|
||||
selectedRows.value = []
|
||||
await loadData()
|
||||
}, fullscreenLoadingText.batchDelete)
|
||||
}
|
||||
// 输入检索条件时自动搜索(防抖 300ms)
|
||||
watchDebounced(
|
||||
searchForm,
|
||||
() => {
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
},
|
||||
{ debounce: 300, deep: true }
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.unit-dialog-form {
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -15,7 +15,7 @@
|
||||
display: flex;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: calc(100vh - 72px);
|
||||
height: calc(100vh - 56px);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
flex-shrink: 0;
|
||||
width: 100%;
|
||||
padding-top: 8px;
|
||||
background: var(--default-bg-color, #fff);
|
||||
background: var(--mint-surface, #fff);
|
||||
}
|
||||
|
||||
#app-content {
|
||||
@@ -68,7 +68,7 @@
|
||||
@media only screen and (width <= 1180px) {
|
||||
.app-layout-portal {
|
||||
#app-portal-body {
|
||||
height: calc(100dvh - 72px);
|
||||
height: calc(100dvh - 56px);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,10 +81,10 @@
|
||||
|
||||
#app-sidebar {
|
||||
position: fixed;
|
||||
top: 72px;
|
||||
top: 56px;
|
||||
left: 0;
|
||||
z-index: 300;
|
||||
height: calc(100vh - 72px);
|
||||
height: calc(100vh - 56px);
|
||||
}
|
||||
|
||||
#app-workspace {
|
||||
|
||||
@@ -54,85 +54,152 @@
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增承运商
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1 || !canApproveCarrier(selectedRows[0])"
|
||||
:loading="selectedRows.length === 1 && auditLoadingMap[selectedRows[0].id]"
|
||||
@click="handleToolbarApprove"
|
||||
>
|
||||
<el-icon><Select /></el-icon>审核通过
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="fetchData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 卡片列表 -->
|
||||
<div class="list-body list-wrap carrier-card-wrap" v-loading="loading">
|
||||
<p v-if="!carrierList.length && !loading" class="carrier-card-empty">暂无承运商</p>
|
||||
|
||||
<div v-else class="carrier-card-grid">
|
||||
<article
|
||||
v-for="row in carrierList"
|
||||
:key="row.id"
|
||||
class="carrier-card"
|
||||
:class="{ 'is-selected': isSelected(row) }"
|
||||
@dblclick="handleView(row)"
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="carrierList"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="carrierName"
|
||||
label="承运商名称"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<div class="carrier-card-head">
|
||||
<el-checkbox
|
||||
:model-value="isSelected(row)"
|
||||
@change="(checked: boolean) => toggleSelect(row, checked)"
|
||||
@click.stop
|
||||
/>
|
||||
<div class="carrier-card-title">
|
||||
<span class="carrier-card-name">{{ row.carrierName }}</span>
|
||||
<el-tag :type="row.status === '1' ? 'success' : 'danger'" size="small">
|
||||
{{ row.status === '1' ? '合作中' : '已终止' }}
|
||||
</el-tag>
|
||||
<el-tag
|
||||
:type="getPlCarrierAuditStatusTagType(row.auditStatus)"
|
||||
size="small"
|
||||
>
|
||||
{{ getPlCarrierAuditStatusLabel(row.auditStatus) }}
|
||||
</el-tag>
|
||||
<el-tag v-if="row.transportAgreementExpired" type="danger" size="small">
|
||||
协议已过期
|
||||
</el-tag>
|
||||
<el-tag v-else-if="row.qualificationComplete === false" type="warning" size="small">
|
||||
资质不全
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.carrierName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('contactName')"
|
||||
prop="contactName"
|
||||
label="联系人"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('contactPhone')"
|
||||
prop="contactPhone"
|
||||
label="联系电话"
|
||||
min-width="130"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('status')"
|
||||
label="合作状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.status === '1' ? 'success' : 'danger'" size="small">
|
||||
{{ row.status === '1' ? '合作中' : '已终止' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('auditStatus')"
|
||||
label="审核状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getPlCarrierAuditStatusTagType(row.auditStatus)" size="small">
|
||||
{{ getPlCarrierAuditStatusLabel(row.auditStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('qualificationHint')"
|
||||
label="资质提示"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.transportAgreementExpired" type="danger" size="small">协议已过期</el-tag>
|
||||
<el-tag v-else-if="row.qualificationComplete === false" type="warning" size="small">
|
||||
资质不全
|
||||
</el-tag>
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('transportAgreementExpireDate')"
|
||||
prop="transportAgreementExpireDate"
|
||||
label="协议有效期"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('remark')"
|
||||
prop="remark"
|
||||
label="备注"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
</el-table>
|
||||
|
||||
<dl class="carrier-card-kv">
|
||||
<div class="carrier-card-kv-item carrier-card-kv-contact-row">
|
||||
<div class="carrier-card-contact-part">
|
||||
<dt>联系人</dt>
|
||||
<dd>{{ row.contactName || '—' }}</dd>
|
||||
</div>
|
||||
<div class="carrier-card-contact-part">
|
||||
<dt>联系电话</dt>
|
||||
<dd>{{ row.contactPhone || '—' }}</dd>
|
||||
</div>
|
||||
</div>
|
||||
<div class="carrier-card-kv-item">
|
||||
<dt>备注</dt>
|
||||
<dd>{{ row.remark || '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div class="carrier-card-actions">
|
||||
<el-button link type="primary" @click.stop="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button link type="primary" @click.stop="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canApproveCarrier(row)"
|
||||
link
|
||||
type="primary"
|
||||
:loading="auditLoadingMap[row.id]"
|
||||
@click.stop="handleApprove(row)"
|
||||
>
|
||||
<el-icon><Select /></el-icon>审核通过
|
||||
</el-button>
|
||||
<el-button link type="danger" :disabled="!canDeleteByCreator(row)" :title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP" @click.stop="handleDelete(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</article>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -232,16 +299,43 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<PlCarrierViewDialog v-model:visible="viewVisible" :carrier-id="viewCarrierId" />
|
||||
<PlCarrierViewDialog v-model:visible="viewVisible" :carrier-id="viewCarrierId">
|
||||
<template v-if="viewingRow" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRow)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canApproveCarrier(viewingRow)"
|
||||
class="btn-ghost"
|
||||
:loading="auditLoadingMap[viewingRow.id]"
|
||||
@click="handleApprove(viewingRow)"
|
||||
>
|
||||
<el-icon><Select /></el-icon>审核通过
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewingRow)"
|
||||
:title="canDeleteByCreator(viewingRow) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(viewingRow)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</PlCarrierViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close, Delete, Edit, Plus, RefreshLeft, Search, Select, View } from '@element-plus/icons-vue'
|
||||
import { Check, Close, Delete, Edit, Plus, RefreshLeft, Search, Select } from '@element-plus/icons-vue'
|
||||
import { carrierApi, type Carrier } from '@/api/pl'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import PlCarrierViewDialog from '@/components/business/pl-carrier-view-dialog/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
import { pickBxPageResult } from '@/utils/http/bx'
|
||||
import { DEFAULT_LIST_PAGE_SIZE } from '@/utils/table/tableConfig'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import {
|
||||
getPlCarrierAuditStatusLabel,
|
||||
@@ -249,6 +343,25 @@ import {
|
||||
} from '@/utils/pl-display'
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'contactName', label: '联系人' },
|
||||
{ prop: 'contactPhone', label: '联系电话' },
|
||||
{ prop: 'status', label: '合作状态' },
|
||||
{ prop: 'auditStatus', label: '审核状态' },
|
||||
{ prop: 'qualificationHint', label: '资质提示' },
|
||||
{ prop: 'transportAgreementExpireDate', label: '协议有效期' },
|
||||
{ prop: 'remark', label: '备注', defaultVisible: false }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('pl-carrier-list-columns', listColumnDefs)
|
||||
|
||||
const submitLoading = ref(false)
|
||||
const auditLoadingMap = reactive<Record<string, boolean>>({})
|
||||
const carrierList = ref<Carrier[]>([])
|
||||
@@ -262,6 +375,7 @@ const transportAgreementUploadRef = ref<InstanceType<typeof AttachmentUploadFiel
|
||||
const isEdit = ref(false)
|
||||
const viewVisible = ref(false)
|
||||
const viewCarrierId = ref('')
|
||||
const viewingRow = ref<Carrier | null>(null)
|
||||
|
||||
const searchForm = reactive({
|
||||
q: '',
|
||||
@@ -269,6 +383,12 @@ const searchForm = reactive({
|
||||
auditStatus: ''
|
||||
})
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
pageSize: DEFAULT_LIST_PAGE_SIZE,
|
||||
total: 0
|
||||
})
|
||||
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
carrierName: '',
|
||||
@@ -347,9 +467,13 @@ async function fetchData() {
|
||||
const res = await carrierApi.list({
|
||||
q: searchForm.q || undefined,
|
||||
status: searchForm.status || undefined,
|
||||
auditStatus: searchForm.auditStatus || undefined
|
||||
auditStatus: searchForm.auditStatus || undefined,
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
carrierList.value = (res.data ?? res) || []
|
||||
const { list, total } = pickBxPageResult<Carrier>(res)
|
||||
carrierList.value = list
|
||||
pagination.total = total
|
||||
const idSet = new Set(carrierList.value.map(item => item.id))
|
||||
selectedRows.value = selectedRows.value.filter(item => idSet.has(item.id))
|
||||
} finally {
|
||||
@@ -358,6 +482,7 @@ async function fetchData() {
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
@@ -366,6 +491,16 @@ function handleReset() {
|
||||
searchForm.status = ''
|
||||
searchForm.auditStatus = ''
|
||||
selectedRows.value = []
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handlePageChange() {
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleSizeChange() {
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
@@ -393,18 +528,32 @@ async function handleApprove(row: Carrier) {
|
||||
}
|
||||
}
|
||||
|
||||
function isSelected(row: Carrier) {
|
||||
return selectedRows.value.some(item => item.id === row.id)
|
||||
function handleSelectionChange(rows: Carrier[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function toggleSelect(row: Carrier, checked: boolean) {
|
||||
if (checked) {
|
||||
if (!isSelected(row)) {
|
||||
selectedRows.value = [...selectedRows.value, row]
|
||||
}
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条承运商')
|
||||
return
|
||||
}
|
||||
selectedRows.value = selectedRows.value.filter(item => item.id !== row.id)
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarApprove() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条承运商')
|
||||
return
|
||||
}
|
||||
handleApprove(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条承运商')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
@@ -444,6 +593,7 @@ function handleEdit(row: Carrier) {
|
||||
}
|
||||
|
||||
function handleView(row: Carrier) {
|
||||
viewingRow.value = row
|
||||
viewCarrierId.value = row.id
|
||||
viewVisible.value = true
|
||||
}
|
||||
@@ -511,6 +661,11 @@ async function handleDelete(row: Carrier) {
|
||||
await ElMessageBox.confirm('确定删除该承运商吗?', '提示', { type: 'warning' })
|
||||
await carrierApi.delete(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
if (viewingRow.value?.id === row.id) {
|
||||
viewVisible.value = false
|
||||
viewingRow.value = null
|
||||
viewCarrierId.value = ''
|
||||
}
|
||||
fetchData()
|
||||
}
|
||||
|
||||
@@ -523,167 +678,3 @@ onMounted(() => {
|
||||
fetchData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.carrier-card-wrap {
|
||||
min-height: 120px;
|
||||
padding: 16px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.carrier-card-empty {
|
||||
margin: 0;
|
||||
padding: 24px 0;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.carrier-card-grid {
|
||||
display: grid;
|
||||
width: 100%;
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
|
||||
gap: 16px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.carrier-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
height: 100%;
|
||||
min-height: 200px;
|
||||
padding: 16px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
||||
transition:
|
||||
border-color 0.2s ease,
|
||||
box-shadow 0.2s ease,
|
||||
background-color 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: #a7f3d0;
|
||||
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
|
||||
}
|
||||
|
||||
&.is-selected {
|
||||
border-color: #10b981;
|
||||
background: #ecfdf5;
|
||||
}
|
||||
}
|
||||
|
||||
.carrier-card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.carrier-card-title {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.carrier-card-name {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
line-height: 1.4;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.carrier-card-kv {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 10px;
|
||||
margin: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.carrier-card-kv-item {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
font-size: 13px;
|
||||
|
||||
&.carrier-card-kv-contact-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.carrier-card-contact-part {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
|
||||
dt {
|
||||
margin: 0;
|
||||
color: #1e293b;
|
||||
font-weight: 500;
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
color: #1e293b;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.carrier-card-kv-item:not(.carrier-card-kv-contact-row) {
|
||||
dt {
|
||||
margin: 0;
|
||||
color: #1e293b;
|
||||
font-weight: 500;
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
color: #1e293b;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.carrier-card-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 4px 8px;
|
||||
padding-top: 12px;
|
||||
margin-top: auto;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.carrier-card-wrap {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.carrier-card-grid {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -41,6 +41,32 @@
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增司机
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length === 0 || !allRowsDeletableByCreator(selectedRows)"
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="fetchData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -53,42 +79,85 @@
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column prop="driverName" label="姓名" min-width="100" align="center" />
|
||||
<el-table-column prop="driverName" label="姓名" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.driverName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="phoneNo" label="手机号" min-width="130" align="center" />
|
||||
<el-table-column prop="idCardNo" label="身份证号" min-width="180" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('idCardNo')"
|
||||
prop="idCardNo"
|
||||
label="身份证号"
|
||||
min-width="180"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ maskIdCard(row.idCardNo) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="drivingLicenseNo" label="驾驶证号" min-width="160" align="center" />
|
||||
<el-table-column prop="drivingLicenseExpire" label="驾驶证有效期" min-width="120" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('drivingLicenseNo')"
|
||||
prop="drivingLicenseNo"
|
||||
label="驾驶证号"
|
||||
min-width="160"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('drivingLicenseExpire')"
|
||||
prop="drivingLicenseExpire"
|
||||
label="驾驶证有效期"
|
||||
min-width="120"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getExpireTagType(row.drivingLicenseExpire)" size="small">
|
||||
{{ row.drivingLicenseExpire || '-' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="vehicleLicenseNo" label="行驶证号" min-width="160" align="center" />
|
||||
<el-table-column prop="hazmatCertNo" label="危化品证号" min-width="160" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('vehicleLicenseNo')"
|
||||
prop="vehicleLicenseNo"
|
||||
label="行驶证号"
|
||||
min-width="160"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('hazmatCertNo')"
|
||||
prop="hazmatCertNo"
|
||||
label="危化品证号"
|
||||
min-width="160"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.hazmatCertNo" type="warning" size="small">有</el-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column label="操作" min-width="160" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" :disabled="!canDeleteByCreator(row)" :title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP" @click="handleDelete(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('remark')"
|
||||
prop="remark"
|
||||
label="备注"
|
||||
min-width="160"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -170,28 +239,93 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewVisible"
|
||||
:title="viewRow?.driverName || '司机详情'"
|
||||
:sections="viewSections"
|
||||
width="720px"
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
>
|
||||
<template v-if="viewRow" #hero-actions>
|
||||
<div class="driver-view-hero-actions">
|
||||
<el-button class="btn-main" type="primary" @click="handleViewEdit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewRow)"
|
||||
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleViewDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close, Delete, Edit, Plus, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { driverApi, type Driver } from '@/api/pl'
|
||||
import SystemViewDialog, { type ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
import { pickBxPageResult } from '@/utils/http/bx'
|
||||
import { DEFAULT_LIST_PAGE_SIZE } from '@/utils/table/tableConfig'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
|
||||
const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const driverList = ref<Driver[]>([])
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'idCardNo', label: '身份证号' },
|
||||
{ prop: 'drivingLicenseNo', label: '驾驶证号' },
|
||||
{ prop: 'drivingLicenseExpire', label: '驾驶证有效期' },
|
||||
{ prop: 'vehicleLicenseNo', label: '行驶证号' },
|
||||
{ prop: 'hazmatCertNo', label: '危化品证号' },
|
||||
{ prop: 'remark', label: '备注', defaultVisible: false }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('pl-driver-list-columns', listColumnDefs, {
|
||||
defaultVisibleProps: [
|
||||
'idCardNo',
|
||||
'drivingLicenseNo',
|
||||
'drivingLicenseExpire',
|
||||
'vehicleLicenseNo',
|
||||
'hazmatCertNo'
|
||||
]
|
||||
})
|
||||
|
||||
const selectedRows = ref<Driver[]>([])
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
const formRef = ref()
|
||||
const isEdit = ref(false)
|
||||
const viewVisible = ref(false)
|
||||
const viewRow = ref<Driver | null>(null)
|
||||
|
||||
const searchForm = reactive({
|
||||
q: ''
|
||||
})
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
pageSize: DEFAULT_LIST_PAGE_SIZE,
|
||||
total: 0
|
||||
})
|
||||
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
driverName: '',
|
||||
@@ -211,7 +345,44 @@ const formRules = {
|
||||
phoneNo: [{ required: true, message: '请输入手机号', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
const multiple = computed(() => selectedRows.value.length === 0)
|
||||
const viewSections = computed<ViewSection[]>(() => {
|
||||
const row = viewRow.value
|
||||
if (!row) return []
|
||||
return [
|
||||
{
|
||||
title: '基本信息',
|
||||
fields: [
|
||||
{ label: '姓名', value: row.driverName },
|
||||
{ label: '手机号', value: row.phoneNo || '—' },
|
||||
{ label: '身份证号', value: maskIdCard(row.idCardNo) },
|
||||
{ label: '备注', value: row.remark || '—', span: 2 }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '证件信息',
|
||||
fields: [
|
||||
{ label: '驾驶证号', value: row.drivingLicenseNo || '—' },
|
||||
{
|
||||
label: '驾驶证有效期',
|
||||
value: row.drivingLicenseExpire || '—',
|
||||
tagType: getExpireTagType(row.drivingLicenseExpire)
|
||||
},
|
||||
{ label: '行驶证号', value: row.vehicleLicenseNo || '—' },
|
||||
{
|
||||
label: '行驶证有效期',
|
||||
value: row.vehicleLicenseExpire || '—',
|
||||
tagType: getExpireTagType(row.vehicleLicenseExpire)
|
||||
},
|
||||
{ label: '危化品证号', value: row.hazmatCertNo || '—' },
|
||||
{
|
||||
label: '危化品证有效期',
|
||||
value: row.hazmatCertExpire || '—',
|
||||
tagType: getExpireTagType(row.hazmatCertExpire)
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
function maskIdCard(idCard: string | undefined) {
|
||||
if (!idCard || idCard.length < 8) return idCard || '-'
|
||||
@@ -231,19 +402,39 @@ function getExpireTagType(dateStr: string | undefined) {
|
||||
async function fetchData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await driverApi.list({ q: searchForm.q || undefined })
|
||||
driverList.value = (res.data ?? res) || []
|
||||
const res = await driverApi.list({
|
||||
q: searchForm.q || undefined,
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
const { list, total } = pickBxPageResult<Driver>(res)
|
||||
driverList.value = list
|
||||
pagination.total = total
|
||||
const idSet = new Set(driverList.value.map(item => item.id))
|
||||
selectedRows.value = selectedRows.value.filter(item => idSet.has(item.id))
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
searchForm.q = ''
|
||||
selectedRows.value = []
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handlePageChange() {
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleSizeChange() {
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
@@ -289,6 +480,49 @@ function handleEdit(row: Driver) {
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
function handleView(row: Driver) {
|
||||
viewRow.value = row
|
||||
viewVisible.value = true
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleViewEdit() {
|
||||
if (!viewRow.value) return
|
||||
viewVisible.value = false
|
||||
handleEdit(viewRow.value)
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length === 0) return
|
||||
if (selectedRows.value.length === 1) {
|
||||
handleDelete(selectedRows.value[0])
|
||||
return
|
||||
}
|
||||
const deletable = filterDeletableByCreator(selectedRows.value)
|
||||
if (deletable.length !== selectedRows.value.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
ElMessageBox.confirm(`确定删除选中的 ${selectedRows.value.length} 条司机吗?`, '提示', {
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
await Promise.all(deletable.map((row) => driverApi.delete(row.id)))
|
||||
ElMessage.success('删除成功')
|
||||
fetchData()
|
||||
})
|
||||
}
|
||||
|
||||
function handleViewDelete() {
|
||||
if (!viewRow.value) return
|
||||
handleDelete(viewRow.value).then(() => {
|
||||
viewVisible.value = false
|
||||
})
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
const valid = await formRef.value.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
@@ -332,3 +566,11 @@ onMounted(() => {
|
||||
fetchData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.driver-view-hero-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -6,16 +6,18 @@
|
||||
<h2 class="title-bar-heading">运费结算审批</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-tabs">
|
||||
<el-tabs v-model="activeTab" @tab-change="handleTabChange">
|
||||
<el-tab-pane label="待审批" name="pending">
|
||||
<ApprovalPendingPanel ref="pendingRef" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="已审批" name="done">
|
||||
<ApprovalDonePanel ref="doneRef" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-tabs
|
||||
v-model="activeTab"
|
||||
class="panel-pill-tabs panel-pill-tabs--lg"
|
||||
@tab-change="handleTabChange"
|
||||
>
|
||||
<el-tab-pane label="待审批" name="pending">
|
||||
<ApprovalPendingPanel ref="pendingRef" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="已审批" name="done">
|
||||
<ApprovalDonePanel ref="doneRef" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -6,16 +6,18 @@
|
||||
<h2 class="title-bar-heading">运费财务发放</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-tabs">
|
||||
<el-tabs v-model="activeTab" @tab-change="handleTabChange">
|
||||
<el-tab-pane label="待发放" name="disburse">
|
||||
<DisbursePanel ref="disburseRef" @disbursed="handleDisbursed" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="已发放" name="settled">
|
||||
<SettledPanel ref="settledRef" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-tabs
|
||||
v-model="activeTab"
|
||||
class="panel-pill-tabs panel-pill-tabs--lg"
|
||||
@tab-change="handleTabChange"
|
||||
>
|
||||
<el-tab-pane label="待发放" name="disburse">
|
||||
<DisbursePanel ref="disburseRef" @disbursed="handleDisbursed" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="已发放" name="settled">
|
||||
<SettledPanel ref="settledRef" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">已选 <span class="sel-num">0</span> 项</div>
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -64,13 +66,6 @@
|
||||
<el-table-column prop="submitterName" label="提交人" min-width="100" align="center">
|
||||
<template #default="{ row }">{{ row.submitterName || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="120" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -91,7 +86,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RefreshLeft, Search, View } from '@element-plus/icons-vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { freightApi, type FreightSettlement } from '@/api/pl'
|
||||
import PlFreightSettlementViewDialog from '@/components/business/pl-freight-settlement-view-dialog/index.vue'
|
||||
import {
|
||||
|
||||
@@ -27,12 +27,49 @@
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">已选 <span class="sel-num">0</span> 项</div>
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="
|
||||
selectedRows.length !== 1 ||
|
||||
!selectedRows[0]?.canApprove ||
|
||||
!selectedRows[0]?.currentApprovalId
|
||||
"
|
||||
@click="handleToolbarApprove"
|
||||
>
|
||||
<el-icon><CircleCheck /></el-icon>通过
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="
|
||||
selectedRows.length !== 1 ||
|
||||
!selectedRows[0]?.canApprove ||
|
||||
!selectedRows[0]?.currentApprovalId
|
||||
"
|
||||
@click="handleToolbarReject"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>驳回
|
||||
</el-button>
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="settlementList" v-loading="loading" stripe row-key="id">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="settlementList"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column prop="settlementNo" label="结算单号" min-width="180" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.settlementNo }}</el-link>
|
||||
@@ -52,29 +89,6 @@
|
||||
<el-table-column prop="createTime" label="提交时间" min-width="160" align="center">
|
||||
<template #default="{ row }">{{ formatDateTime(row.createTime) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="260" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.canApprove && row.currentApprovalId"
|
||||
link
|
||||
type="success"
|
||||
@click="handleApprove(row)"
|
||||
>
|
||||
<el-icon><CircleCheck /></el-icon>通过
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.canApprove && row.currentApprovalId"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleReject(row)"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>驳回
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -90,13 +104,33 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<PlFreightSettlementViewDialog ref="viewDialogRef" />
|
||||
<PlFreightSettlementViewDialog ref="viewDialogRef">
|
||||
<template v-if="viewingRow" #hero-actions>
|
||||
<el-button
|
||||
v-if="viewingRow.canApprove && viewingRow.currentApprovalId"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleApprove(viewingRow)"
|
||||
>
|
||||
<el-icon><CircleCheck /></el-icon>通过
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingRow.canApprove && viewingRow.currentApprovalId"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
@click="handleReject(viewingRow)"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>驳回
|
||||
</el-button>
|
||||
</template>
|
||||
</PlFreightSettlementViewDialog>
|
||||
<PlFreightApprovalDialog ref="approvalDialogRef" @success="fetchData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { CircleCheck, CircleClose, RefreshLeft, Search, View } from '@element-plus/icons-vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { CircleCheck, CircleClose, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { freightApi, type FreightSettlement } from '@/api/pl'
|
||||
import PlFreightApprovalDialog from '@/components/business/pl-freight-approval-dialog/index.vue'
|
||||
import PlFreightSettlementViewDialog from '@/components/business/pl-freight-settlement-view-dialog/index.vue'
|
||||
@@ -105,6 +139,8 @@ import { formatDateTime } from '@/utils/format'
|
||||
|
||||
const loading = ref(false)
|
||||
const settlementList = ref<FreightSettlement[]>([])
|
||||
const selectedRows = ref<FreightSettlement[]>([])
|
||||
const viewingRow = ref<FreightSettlement | null>(null)
|
||||
const viewDialogRef = ref<InstanceType<typeof PlFreightSettlementViewDialog>>()
|
||||
const approvalDialogRef = ref<InstanceType<typeof PlFreightApprovalDialog>>()
|
||||
|
||||
@@ -121,6 +157,10 @@ function formatAmount(amount: number) {
|
||||
return formatMoneyDisplay(amount)
|
||||
}
|
||||
|
||||
function handleSelectionChange(selection: FreightSettlement[]) {
|
||||
selectedRows.value = selection
|
||||
}
|
||||
|
||||
async function fetchData() {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -159,6 +199,7 @@ function handleSizeChange() {
|
||||
}
|
||||
|
||||
function handleView(row: FreightSettlement) {
|
||||
viewingRow.value = row
|
||||
viewDialogRef.value?.open(row.id)
|
||||
}
|
||||
|
||||
@@ -172,6 +213,16 @@ function handleReject(row: FreightSettlement) {
|
||||
approvalDialogRef.value?.openReject(row.id, row.currentApprovalId)
|
||||
}
|
||||
|
||||
function handleToolbarApprove() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleApprove(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarReject() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleReject(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
fetchData()
|
||||
}
|
||||
|
||||
@@ -27,12 +27,33 @@
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">已选 <span class="sel-num">0</span> 项</div>
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarDisburse"
|
||||
>
|
||||
<el-icon><Money /></el-icon>发放登记
|
||||
</el-button>
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="settlementList" v-loading="loading" stripe row-key="id">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="settlementList"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column prop="settlementNo" label="结算单号" min-width="180" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.settlementNo }}</el-link>
|
||||
@@ -51,16 +72,6 @@
|
||||
<el-table-column prop="submitterName" label="提交人" min-width="100" align="center">
|
||||
<template #default="{ row }">{{ row.submitterName || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="200" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button link type="primary" @click="handleDisburse(row)">
|
||||
<el-icon><Money /></el-icon>发放登记
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -76,13 +87,20 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<PlFreightSettlementViewDialog ref="viewDialogRef" />
|
||||
<PlFreightSettlementViewDialog ref="viewDialogRef">
|
||||
<template v-if="viewingRow" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleDisburse(viewingRow)">
|
||||
<el-icon><Money /></el-icon>发放登记
|
||||
</el-button>
|
||||
</template>
|
||||
</PlFreightSettlementViewDialog>
|
||||
<PlFreightDisburseDialog ref="disburseDialogRef" @success="handleDisburseSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Money, RefreshLeft, Search, View } from '@element-plus/icons-vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { Money, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { freightApi, type FreightSettlement } from '@/api/pl'
|
||||
import PlFreightDisburseDialog from '@/components/business/pl-freight-disburse-dialog/index.vue'
|
||||
import PlFreightSettlementViewDialog from '@/components/business/pl-freight-settlement-view-dialog/index.vue'
|
||||
@@ -93,6 +111,8 @@ const emit = defineEmits<{ disbursed: [] }>()
|
||||
|
||||
const loading = ref(false)
|
||||
const settlementList = ref<FreightSettlement[]>([])
|
||||
const selectedRows = ref<FreightSettlement[]>([])
|
||||
const viewingRow = ref<FreightSettlement | null>(null)
|
||||
const viewDialogRef = ref<InstanceType<typeof PlFreightSettlementViewDialog>>()
|
||||
const disburseDialogRef = ref<InstanceType<typeof PlFreightDisburseDialog>>()
|
||||
|
||||
@@ -109,6 +129,10 @@ function formatAmount(amount: number) {
|
||||
return formatMoneyDisplay(amount)
|
||||
}
|
||||
|
||||
function handleSelectionChange(selection: FreightSettlement[]) {
|
||||
selectedRows.value = selection
|
||||
}
|
||||
|
||||
async function fetchData() {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -147,6 +171,7 @@ function handleSizeChange() {
|
||||
}
|
||||
|
||||
function handleView(row: FreightSettlement) {
|
||||
viewingRow.value = row
|
||||
viewDialogRef.value?.open(row.id)
|
||||
}
|
||||
|
||||
@@ -154,6 +179,11 @@ function handleDisburse(row: FreightSettlement) {
|
||||
disburseDialogRef.value?.open(row.id)
|
||||
}
|
||||
|
||||
function handleToolbarDisburse() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleDisburse(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleDisburseSuccess() {
|
||||
fetchData()
|
||||
emit('disbursed')
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">已选 <span class="sel-num">0</span> 项</div>
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -58,13 +60,6 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="120" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -85,7 +80,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RefreshLeft, Search, View } from '@element-plus/icons-vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { freightApi, type FreightSettlement } from '@/api/pl'
|
||||
import PlFreightSettlementViewDialog from '@/components/business/pl-freight-settlement-view-dialog/index.vue'
|
||||
import {
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
<el-option label="审批中" value="approving" />
|
||||
<el-option label="待发放" value="approved" />
|
||||
<el-option label="已发放" value="confirmed" />
|
||||
<el-option label="已作废" value="cancelled" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
@@ -45,12 +46,75 @@
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">已选 <span class="sel-num">0</span> 项</div>
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
v-if="selectedRows.length === 1 && selectedRows[0].settlementStatus === 'pending'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedRows.length === 1 && selectedRows[0].settlementStatus === 'approved'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>发票信息
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedRows.length === 1 && selectedRows[0].settlementStatus === 'pending'"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarSubmit"
|
||||
>
|
||||
<el-icon><Promotion /></el-icon>提交审批
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="
|
||||
selectedRows.length === 1 &&
|
||||
selectedRows[0].settlementStatus === 'pending' &&
|
||||
canDeleteByCreator(selectedRows[0])
|
||||
"
|
||||
class="btn-ghost"
|
||||
type="warning"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
:loading="cancelLoadingMap[selectedRows[0]?.id]"
|
||||
@click="handleToolbarCancel"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedRows.length === 1 && selectedRows[0].canWithdraw"
|
||||
class="btn-ghost"
|
||||
type="warning"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarWithdraw"
|
||||
>
|
||||
<el-icon><RefreshLeft /></el-icon>撤回
|
||||
</el-button>
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="settlementList" v-loading="loading" stripe row-key="id">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="settlementList"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column prop="settlementNo" label="结算单号" min-width="180" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.settlementNo }}</el-link>
|
||||
@@ -87,53 +151,6 @@
|
||||
<el-table-column prop="createTime" label="创建时间" min-width="160" align="center">
|
||||
<template #default="{ row }">{{ formatDateTime(row.createTime) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="320" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.settlementStatus === 'pending'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.settlementStatus === 'approved'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>发票信息
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.settlementStatus === 'pending'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleSubmit(row)"
|
||||
>
|
||||
<el-icon><Promotion /></el-icon>提交审批
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.settlementStatus === 'pending' && canDeleteByCreator(row)"
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.canWithdraw"
|
||||
link
|
||||
type="warning"
|
||||
@click="handleWithdraw(row)"
|
||||
>
|
||||
<el-icon><RefreshLeft /></el-icon>撤回
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -149,22 +166,66 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<PlFreightSettlementViewDialog ref="viewDialogRef" />
|
||||
<PlFreightSettlementViewDialog ref="viewDialogRef">
|
||||
<template v-if="viewingRow" #hero-actions>
|
||||
<el-button
|
||||
v-if="viewingRow.settlementStatus === 'pending'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleEdit(viewingRow)"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingRow.settlementStatus === 'approved'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleEdit(viewingRow)"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>发票信息
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingRow.settlementStatus === 'pending'"
|
||||
class="btn-ghost"
|
||||
@click="handleSubmit(viewingRow)"
|
||||
>
|
||||
<el-icon><Promotion /></el-icon>提交审批
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingRow.settlementStatus === 'pending' && canDeleteByCreator(viewingRow)"
|
||||
class="btn-ghost"
|
||||
type="warning"
|
||||
:loading="cancelLoadingMap[viewingRow.id]"
|
||||
@click="handleCancel(viewingRow)"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingRow.canWithdraw"
|
||||
class="btn-ghost"
|
||||
type="warning"
|
||||
@click="handleWithdraw(viewingRow)"
|
||||
>
|
||||
<el-icon><RefreshLeft /></el-icon>撤回
|
||||
</el-button>
|
||||
</template>
|
||||
</PlFreightSettlementViewDialog>
|
||||
<PlFreightSettlementFormDialog ref="formDialogRef" @success="fetchData" />
|
||||
<PlFreightApprovalDialog ref="approvalDialogRef" @success="fetchData" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import {
|
||||
Delete,
|
||||
CircleClose,
|
||||
Edit,
|
||||
Promotion,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
View
|
||||
Search
|
||||
} from '@element-plus/icons-vue'
|
||||
import { carrierApi, freightApi, type Carrier, type FreightSettlement } from '@/api/pl'
|
||||
import { pickBxList } from '@/utils/http/bx'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import PlFreightApprovalDialog from '@/components/business/pl-freight-approval-dialog/index.vue'
|
||||
import PlFreightSettlementFormDialog from '@/components/business/pl-freight-settlement-form-dialog/index.vue'
|
||||
@@ -177,8 +238,11 @@ import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { formatDateTime } from '@/utils/format'
|
||||
|
||||
const loading = ref(false)
|
||||
const cancelLoadingMap = reactive<Record<string, boolean>>({})
|
||||
const carrierList = ref<Carrier[]>([])
|
||||
const settlementList = ref<FreightSettlement[]>([])
|
||||
const selectedRows = ref<FreightSettlement[]>([])
|
||||
const viewingRow = ref<FreightSettlement | null>(null)
|
||||
const viewDialogRef = ref<InstanceType<typeof PlFreightSettlementViewDialog>>()
|
||||
const formDialogRef = ref<InstanceType<typeof PlFreightSettlementFormDialog>>()
|
||||
const approvalDialogRef = ref<InstanceType<typeof PlFreightApprovalDialog>>()
|
||||
@@ -200,6 +264,10 @@ function formatAmount(amount: number) {
|
||||
return formatMoneyDisplay(amount)
|
||||
}
|
||||
|
||||
function handleSelectionChange(selection: FreightSettlement[]) {
|
||||
selectedRows.value = selection
|
||||
}
|
||||
|
||||
async function fetchData() {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -234,8 +302,8 @@ function handleReset() {
|
||||
|
||||
async function loadCarrierList() {
|
||||
try {
|
||||
const res = await carrierApi.list({ status: '1' })
|
||||
carrierList.value = (res.data ?? res) || []
|
||||
const res = await carrierApi.list({ status: '1', page: 1, pageSize: 100 })
|
||||
carrierList.value = pickBxList(res)
|
||||
} catch {
|
||||
carrierList.value = []
|
||||
}
|
||||
@@ -251,6 +319,7 @@ function handleSizeChange() {
|
||||
}
|
||||
|
||||
function handleView(row: FreightSettlement) {
|
||||
viewingRow.value = row
|
||||
viewDialogRef.value?.open(row.id)
|
||||
}
|
||||
|
||||
@@ -262,6 +331,16 @@ function handleSubmit(row: FreightSettlement) {
|
||||
approvalDialogRef.value?.openSubmit(row.id)
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarSubmit() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleSubmit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleWithdraw(row: FreightSettlement) {
|
||||
await ElMessageBox.confirm('确定撤回该结算单的审批吗?', '提示', { type: 'warning' })
|
||||
await freightApi.withdrawApproval(row.id)
|
||||
@@ -269,17 +348,32 @@ async function handleWithdraw(row: FreightSettlement) {
|
||||
fetchData()
|
||||
}
|
||||
|
||||
async function handleDelete(row: FreightSettlement) {
|
||||
function handleToolbarWithdraw() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleWithdraw(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleCancel(row: FreightSettlement) {
|
||||
if (!canDeleteByCreator(row)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
await ElMessageBox.confirm('确定删除该草稿结算单吗?关联运输单将释放。', '提示', {
|
||||
await ElMessageBox.confirm('确定作废该草稿结算单吗?关联运输单将释放。', '提示', {
|
||||
type: 'warning'
|
||||
})
|
||||
await freightApi.delete(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
fetchData()
|
||||
cancelLoadingMap[row.id] = true
|
||||
try {
|
||||
await freightApi.cancel(row.id)
|
||||
ElMessage.success('已作废')
|
||||
fetchData()
|
||||
} finally {
|
||||
cancelLoadingMap[row.id] = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarCancel() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleCancel(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
>
|
||||
<el-icon><DocumentAdd /></el-icon>生成结算单
|
||||
</el-button>
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -72,7 +73,11 @@
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" min-width="48" align="center" />
|
||||
<el-table-column prop="planNo" label="计划编号" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="planNo" label="计划编号" min-width="160" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleViewPlan(row)">{{ row.planNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="planDate" label="计划日期" min-width="120" align="center" />
|
||||
<el-table-column prop="planType" label="单据类型" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
@@ -96,13 +101,6 @@
|
||||
row.archiveTime ? formatDateTime(row.archiveTime) : '—'
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="100" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleViewPlan(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -123,8 +121,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { DocumentAdd, RefreshLeft, Search, View } from '@element-plus/icons-vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { DocumentAdd, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { carrierApi, freightApi, type Carrier, type UnsettledPlanItem } from '@/api/pl'
|
||||
import { pickBxList } from '@/utils/http/bx'
|
||||
import PlPlanViewDialog from '@/components/business/pl-plan-view-dialog/index.vue'
|
||||
import { getPlanTypeLabel, getPlanTypeTagType } from '@/views/pl/freight/freight-status'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
@@ -193,8 +193,8 @@ function handleReset() {
|
||||
|
||||
async function loadCarrierList() {
|
||||
try {
|
||||
const res = await carrierApi.list({ status: '1' })
|
||||
carrierList.value = (res.data ?? res) || []
|
||||
const res = await carrierApi.list({ status: '1', page: 1, pageSize: 100 })
|
||||
carrierList.value = pickBxList(res)
|
||||
} catch {
|
||||
carrierList.value = []
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
export type SettlementStatus = 'pending' | 'approving' | 'approved' | 'confirmed'
|
||||
export type SettlementStatus = 'pending' | 'approving' | 'approved' | 'confirmed' | 'cancelled'
|
||||
|
||||
export function getSettlementStatusTagType(
|
||||
status: string
|
||||
): 'info' | 'warning' | 'success' | 'primary' {
|
||||
const map: Record<string, 'info' | 'warning' | 'success' | 'primary'> = {
|
||||
): 'info' | 'warning' | 'success' | 'primary' | 'danger' {
|
||||
const map: Record<string, 'info' | 'warning' | 'success' | 'primary' | 'danger'> = {
|
||||
pending: 'info',
|
||||
approving: 'warning',
|
||||
approved: 'primary',
|
||||
confirmed: 'success'
|
||||
confirmed: 'success',
|
||||
cancelled: 'danger'
|
||||
}
|
||||
return map[status] || 'info'
|
||||
}
|
||||
@@ -17,7 +18,8 @@ export function getSettlementStatusLabel(status: string) {
|
||||
pending: '草稿',
|
||||
approving: '审批中',
|
||||
approved: '待发放',
|
||||
confirmed: '已发放'
|
||||
confirmed: '已发放',
|
||||
cancelled: '已作废'
|
||||
}
|
||||
return map[status] || status
|
||||
}
|
||||
|
||||
@@ -6,16 +6,18 @@
|
||||
<h2 class="title-bar-heading">运费结算</h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-tabs">
|
||||
<el-tabs v-model="activeTab" @tab-change="handleTabChange">
|
||||
<el-tab-pane label="未结算计划" name="unsettled">
|
||||
<UnsettledPlanPanel ref="unsettledRef" @created="handleSettlementCreated" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="结算单" name="bills">
|
||||
<SettlementBillPanel ref="billsRef" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-tabs
|
||||
v-model="activeTab"
|
||||
class="panel-pill-tabs panel-pill-tabs--lg"
|
||||
@tab-change="handleTabChange"
|
||||
>
|
||||
<el-tab-pane label="未结算计划" name="unsettled">
|
||||
<UnsettledPlanPanel ref="unsettledRef" @created="handleSettlementCreated" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="结算单" name="bills">
|
||||
<SettlementBillPanel ref="billsRef" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -31,12 +31,33 @@
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">已选 <span class="sel-num">0</span> 项</div>
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="!canToolbarResolve"
|
||||
:loading="resolveLoading"
|
||||
@click="handleToolbarResolve"
|
||||
>
|
||||
<el-icon><CircleCheck /></el-icon>处理
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="reminderList" v-loading="loading" stripe row-key="id">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="reminderList"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column prop="ownerType" label="主体类型" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getOwnerTypeTagType(row.ownerType)" size="small">
|
||||
@@ -73,18 +94,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="处理备注" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column label="操作" min-width="120" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="row.status === 'pending'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleResolve(row)"
|
||||
>
|
||||
<el-icon><CircleCheck /></el-icon>处理
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</section>
|
||||
@@ -92,17 +101,28 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { CircleCheck, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { inventoryApi, type DocumentReminder } from '@/api/pl'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
|
||||
const loading = ref(false)
|
||||
const resolveLoading = ref(false)
|
||||
const reminderList = ref<DocumentReminder[]>([])
|
||||
const selectedRows = ref<DocumentReminder[]>([])
|
||||
|
||||
const searchForm = reactive({
|
||||
status: ''
|
||||
})
|
||||
|
||||
const selectedRow = computed(() =>
|
||||
selectedRows.value.length === 1 ? selectedRows.value[0] : null
|
||||
)
|
||||
|
||||
const canToolbarResolve = computed(
|
||||
() => selectedRow.value?.status === 'pending'
|
||||
)
|
||||
|
||||
function getDocTypeTagType(type: string) {
|
||||
const map: Record<string, string> = {
|
||||
driving_license: 'primary',
|
||||
@@ -158,20 +178,32 @@ function handleReset() {
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: DocumentReminder[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
async function handleResolve(row: DocumentReminder) {
|
||||
try {
|
||||
const { value: remark } = await ElMessageBox.prompt('请输入处理备注', '处理证件提醒', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消'
|
||||
})
|
||||
resolveLoading.value = true
|
||||
await inventoryApi.updateDocumentReminder(row.id, { status: 'resolved', remark })
|
||||
ElMessage.success('处理成功')
|
||||
fetchData()
|
||||
} catch {
|
||||
// 用户取消
|
||||
} finally {
|
||||
resolveLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarResolve() {
|
||||
if (!selectedRow.value || !canToolbarResolve.value) return
|
||||
handleResolve(selectedRow.value)
|
||||
}
|
||||
|
||||
useDbInstantSearch(() => ({ status: searchForm.status }), handleSearch)
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">已选 <span class="sel-num">0</span> 项</div>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -100,6 +102,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { inventoryApi, type InventoryRecord } from '@/api/pl'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
|
||||
@@ -47,79 +47,136 @@
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增人员
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="fetchData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 卡片列表 -->
|
||||
<div class="list-body list-wrap personnel-card-wrap" v-loading="loading">
|
||||
<p v-if="!personnelRows.length && !loading" class="personnel-card-empty">暂无人员</p>
|
||||
|
||||
<div v-else class="personnel-card-grid">
|
||||
<article
|
||||
v-for="row in personnelRows"
|
||||
:key="row.id"
|
||||
class="personnel-card"
|
||||
:class="{ 'is-selected': isSelected(row) }"
|
||||
@dblclick="handleView(row)"
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="personnelRows"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="personnelName"
|
||||
label="姓名"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<div class="personnel-card-head">
|
||||
<el-checkbox
|
||||
:model-value="isSelected(row)"
|
||||
@change="(checked: boolean) => toggleSelect(row, checked)"
|
||||
@click.stop
|
||||
/>
|
||||
<div class="personnel-card-title">
|
||||
<span class="personnel-card-name">{{ row.personnelName }}</span>
|
||||
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">
|
||||
{{ row.status === '1' ? '在职' : '停用' }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.personnelName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('phoneNo')"
|
||||
prop="phoneNo"
|
||||
label="手机号"
|
||||
min-width="130"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('age')"
|
||||
prop="age"
|
||||
label="年龄"
|
||||
min-width="80"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('idCardNo')"
|
||||
label="身份证号"
|
||||
min-width="180"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ maskIdCard(row.idCardNo) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('status')"
|
||||
label="状态"
|
||||
min-width="90"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.status === '1' ? 'success' : 'info'" size="small">
|
||||
{{ row.status === '1' ? '在职' : '停用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('nearestExpireDate')"
|
||||
label="最近到期"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
v-if="row.nearestExpireDate"
|
||||
:type="getExpireTagType(row.nearestExpireDate)"
|
||||
size="small"
|
||||
>
|
||||
{{ row.nearestExpireDate }}
|
||||
</el-tag>
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('remark')"
|
||||
prop="remark"
|
||||
label="备注"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
</el-table>
|
||||
|
||||
<dl class="personnel-card-kv">
|
||||
<div class="personnel-card-kv-item">
|
||||
<dt>手机号</dt>
|
||||
<dd>{{ row.phoneNo || '—' }}</dd>
|
||||
</div>
|
||||
<div class="personnel-card-kv-item">
|
||||
<dt>年龄</dt>
|
||||
<dd>{{ row.age ?? '—' }}</dd>
|
||||
</div>
|
||||
<div class="personnel-card-kv-item">
|
||||
<dt>身份证号</dt>
|
||||
<dd>{{ maskIdCard(row.idCardNo) }}</dd>
|
||||
</div>
|
||||
<div class="personnel-card-kv-item">
|
||||
<dt>最近到期</dt>
|
||||
<dd>
|
||||
<el-tag
|
||||
v-if="row.nearestExpireDate"
|
||||
:type="getExpireTagType(row.nearestExpireDate)"
|
||||
size="small"
|
||||
>
|
||||
{{ row.nearestExpireDate }}
|
||||
</el-tag>
|
||||
<span v-else>—</span>
|
||||
</dd>
|
||||
</div>
|
||||
<div v-if="row.remark" class="personnel-card-kv-item personnel-card-kv-span">
|
||||
<dt>备注</dt>
|
||||
<dd>{{ row.remark }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div class="personnel-card-actions">
|
||||
<el-button link type="primary" @click.stop="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button link type="primary" @click.stop="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" :disabled="!canDeleteByCreator(row)" :title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP" @click.stop="handleDelete(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</article>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -202,6 +259,20 @@
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
>
|
||||
<template v-if="viewDetail" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEditFromView">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewDetail)"
|
||||
:title="canDeleteByCreator(viewDetail) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDeleteFromView"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</template>
|
||||
<template #certs>
|
||||
<PlCertViewList :cert-list="viewDetail?.certList || []" />
|
||||
</template>
|
||||
@@ -210,14 +281,18 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close, Delete, Edit, Plus, RefreshLeft, Search, User, View } from '@element-plus/icons-vue'
|
||||
import { Check, Close, Delete, Edit, Plus, RefreshLeft, Search, User } from '@element-plus/icons-vue'
|
||||
import { personnelApi, type Personnel, type PersonnelDetail, type CertRow } from '@/api/pl'
|
||||
import PlCertFormList from '@/components/business/pl-cert-form-list/index.vue'
|
||||
import PlCertViewList from '@/components/business/pl-cert-view-list/index.vue'
|
||||
import SystemViewDialog, {
|
||||
type ViewSection
|
||||
} from '@/components/business/system-view-dialog/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
import { pickBxPageResult } from '@/utils/http/bx'
|
||||
import { DEFAULT_LIST_PAGE_SIZE } from '@/utils/table/tableConfig'
|
||||
import { formatDateTime } from '@/utils/format'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
|
||||
@@ -225,6 +300,24 @@ type CertListItem = CertRow & { _key?: string }
|
||||
type CertFormListRef = InstanceType<typeof PlCertFormList>
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'phoneNo', label: '手机号' },
|
||||
{ prop: 'age', label: '年龄' },
|
||||
{ prop: 'idCardNo', label: '身份证号' },
|
||||
{ prop: 'status', label: '状态' },
|
||||
{ prop: 'nearestExpireDate', label: '最近到期' },
|
||||
{ prop: 'remark', label: '备注', defaultVisible: false }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('pl-personnel-list-columns', listColumnDefs)
|
||||
|
||||
const submitLoading = ref(false)
|
||||
const personnelRows = ref<Personnel[]>([])
|
||||
const selectedRows = ref<Personnel[]>([])
|
||||
@@ -251,6 +344,12 @@ const searchForm = reactive({
|
||||
status: ''
|
||||
})
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
pageSize: DEFAULT_LIST_PAGE_SIZE,
|
||||
total: 0
|
||||
})
|
||||
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
personnelName: '',
|
||||
@@ -347,9 +446,13 @@ async function fetchData() {
|
||||
try {
|
||||
const res = await personnelApi.list({
|
||||
q: searchForm.q || undefined,
|
||||
status: searchForm.status || undefined
|
||||
status: searchForm.status || undefined,
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
personnelRows.value = (res.data ?? res) || []
|
||||
const { list, total } = pickBxPageResult<Personnel>(res)
|
||||
personnelRows.value = list
|
||||
pagination.total = total
|
||||
const idSet = new Set(personnelRows.value.map(item => item.id))
|
||||
selectedRows.value = selectedRows.value.filter(item => idSet.has(item.id))
|
||||
} finally {
|
||||
@@ -358,6 +461,7 @@ async function fetchData() {
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
@@ -365,21 +469,50 @@ function handleReset() {
|
||||
searchForm.q = ''
|
||||
searchForm.status = ''
|
||||
selectedRows.value = []
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function isSelected(row: Personnel) {
|
||||
return selectedRows.value.some(item => item.id === row.id)
|
||||
function handlePageChange() {
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function toggleSelect(row: Personnel, checked: boolean) {
|
||||
if (checked) {
|
||||
if (!isSelected(row)) {
|
||||
selectedRows.value = [...selectedRows.value, row]
|
||||
}
|
||||
function handleSizeChange() {
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: Personnel[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条人员记录')
|
||||
return
|
||||
}
|
||||
selectedRows.value = selectedRows.value.filter(item => item.id !== row.id)
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条人员记录')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleEditFromView() {
|
||||
if (!viewDetail.value) return
|
||||
viewVisible.value = false
|
||||
handleEdit(viewDetail.value)
|
||||
}
|
||||
|
||||
async function handleDeleteFromView() {
|
||||
if (!viewDetail.value) return
|
||||
await handleDelete(viewDetail.value)
|
||||
viewVisible.value = false
|
||||
viewDetail.value = null
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
@@ -497,6 +630,10 @@ async function handleDelete(row: Personnel) {
|
||||
await ElMessageBox.confirm('确定删除该人员吗?', '提示', { type: 'warning' })
|
||||
await personnelApi.delete(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
if (viewDetail.value?.id === row.id) {
|
||||
viewVisible.value = false
|
||||
viewDetail.value = null
|
||||
}
|
||||
fetchData()
|
||||
}
|
||||
|
||||
@@ -514,116 +651,6 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.personnel-card-wrap {
|
||||
min-height: 120px;
|
||||
padding: 16px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.personnel-card-empty {
|
||||
margin: 0;
|
||||
padding: 24px 0;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.personnel-card-grid {
|
||||
display: grid;
|
||||
width: 100%;
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.personnel-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
||||
transition:
|
||||
border-color 0.2s ease,
|
||||
box-shadow 0.2s ease,
|
||||
background-color 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: #a7f3d0;
|
||||
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
|
||||
}
|
||||
|
||||
&.is-selected {
|
||||
border-color: #10b981;
|
||||
background: #ecfdf5;
|
||||
}
|
||||
}
|
||||
|
||||
.personnel-card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.personnel-card-title {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.personnel-card-name {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.personnel-card-kv {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 10px 16px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.personnel-card-kv-item {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
font-size: 13px;
|
||||
|
||||
dt {
|
||||
margin: 0;
|
||||
color: #1e293b;
|
||||
font-weight: 500;
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
color: #1e293b;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
.personnel-card-kv-span {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.personnel-card-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 4px 8px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.sub-table-section {
|
||||
margin-top: 16px;
|
||||
grid-column: 1 / -1;
|
||||
@@ -645,19 +672,4 @@ onMounted(() => {
|
||||
.sub-table {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.personnel-card-wrap {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.personnel-card-grid {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.personnel-card-kv {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -97,10 +97,53 @@
|
||||
</div>
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-row pl-plan-list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<ListToolbarDateShortcuts
|
||||
:active="activeDateShortcut"
|
||||
aria-label="计划日期快捷筛选"
|
||||
@change="handleDateShortcut"
|
||||
/>
|
||||
<el-input
|
||||
v-model="quickSearch"
|
||||
class="quick-search-input"
|
||||
placeholder="计划编号/客户名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuickSearch"
|
||||
@clear="handleQuickSearchClear"
|
||||
>
|
||||
<template #suffix>
|
||||
<el-icon class="quick-search-icon" @click="handleQuickSearch"><Search /></el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-button
|
||||
v-if="selectedPlan && selectedPlan.followStatus !== 'cancelled'"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedPlan && selectedPlan.followStatus !== 'cancelled'"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarArchive"
|
||||
>
|
||||
<el-icon><FolderChecked /></el-icon>{{ archiveButtonLabel(selectedPlan) }}
|
||||
</el-button>
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="fetchData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -112,6 +155,7 @@
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column prop="planNo" label="计划编号" min-width="180" show-overflow-tooltip>
|
||||
@@ -119,67 +163,99 @@
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.planNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="planDate" label="计划日期" min-width="120" align="center" />
|
||||
<el-table-column prop="planType" label="单据类型" min-width="100" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('planDate')"
|
||||
prop="planDate"
|
||||
label="计划日期"
|
||||
min-width="120"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('planType')"
|
||||
prop="planType"
|
||||
label="单据类型"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getPlanTypeTagType(row.planType)" size="small">
|
||||
{{ getPlanTypeLabel(row.planType) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="customerName" label="客户名称" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="产品信息" min-width="240">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('customerName')"
|
||||
prop="customerName"
|
||||
label="客户名称"
|
||||
min-width="180"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column v-if="isColumnVisible('products')" label="产品信息" min-width="240">
|
||||
<template #default="{ row }">
|
||||
<PlPlanListProductCell :products="row.products" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="archiveStatus" label="归档状态" min-width="100" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('archiveStatus')"
|
||||
prop="archiveStatus"
|
||||
label="归档状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getPlPlanArchiveStatusTagType(row.archiveStatus)" size="small">
|
||||
{{ getPlPlanArchiveStatusLabel(row.archiveStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="followStatus" label="跟进状态" min-width="100" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('followStatus')"
|
||||
prop="followStatus"
|
||||
label="跟进状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getFollowStatusTagType(row.followStatus)" size="small">
|
||||
{{ getFollowStatusLabel(row.followStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="transportStatus" label="运输状态" min-width="100" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('transportStatus')"
|
||||
prop="transportStatus"
|
||||
label="运输状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.transportStatus === 'arranged' ? 'success' : 'info'" size="small">
|
||||
{{ row.transportStatus === 'arranged' ? '已安排' : '待安排' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="licensePlate" label="车牌号" min-width="120" align="center" />
|
||||
<el-table-column prop="driverName" label="司机" min-width="100" align="center" />
|
||||
<el-table-column prop="followUserName" label="跟进人" min-width="100" align="center" />
|
||||
<el-table-column label="操作" min-width="260" fixed="right" align="center" class-name="col-actions">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.followStatus !== 'cancelled'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.followStatus !== 'cancelled'"
|
||||
link
|
||||
type="success"
|
||||
@click="handleArchive(row)"
|
||||
>
|
||||
<el-icon><FolderChecked /></el-icon>{{ row.archiveStatus === 'archived' ? '调整' : '归档' }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('licensePlate')"
|
||||
prop="licensePlate"
|
||||
label="车牌号"
|
||||
min-width="120"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('personnelSummary')"
|
||||
prop="personnelSummary"
|
||||
label="人员"
|
||||
min-width="180"
|
||||
show-overflow-tooltip
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('followUserName')"
|
||||
prop="followUserName"
|
||||
label="跟进人"
|
||||
min-width="100"
|
||||
align="center"
|
||||
/>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -202,7 +278,25 @@
|
||||
@success="fetchData"
|
||||
/>
|
||||
|
||||
<PlPlanViewDialog v-model:visible="viewVisible" :plan-id="viewPlanId" />
|
||||
<PlPlanViewDialog v-model:visible="viewVisible" :plan-id="viewPlanId">
|
||||
<template v-if="viewingPlan" #hero-actions>
|
||||
<el-button
|
||||
v-if="viewingPlan.followStatus !== 'cancelled'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleEdit(viewingPlan)"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingPlan.followStatus !== 'cancelled'"
|
||||
class="btn-ghost"
|
||||
@click="handleArchive(viewingPlan)"
|
||||
>
|
||||
<el-icon><FolderChecked /></el-icon>{{ archiveButtonLabel(viewingPlan) }}
|
||||
</el-button>
|
||||
</template>
|
||||
</PlPlanViewDialog>
|
||||
|
||||
<PlPlanArchiveDialog
|
||||
v-model:visible="archiveDialogVisible"
|
||||
@@ -213,21 +307,24 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import {
|
||||
ArrowDownBold,
|
||||
ArrowUpBold,
|
||||
Edit,
|
||||
FolderChecked,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
View
|
||||
Search
|
||||
} from '@element-plus/icons-vue'
|
||||
import { planApi, type Plan } from '@/api/pl'
|
||||
import PlPlanArchiveDialog from '@/components/business/pl-plan-archive-dialog/index.vue'
|
||||
import PlPlanFormDialog from '@/components/business/pl-plan-form-dialog/index.vue'
|
||||
import PlPlanListProductCell from '@/components/business/pl-plan-list-product-cell/index.vue'
|
||||
import PlPlanViewDialog from '@/components/business/pl-plan-view-dialog/index.vue'
|
||||
import ListToolbarDateShortcuts from '@/components/core/list-toolbar-date-shortcuts/index.vue'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
import { useListDateShortcut } from '@/composables/useListDateShortcut'
|
||||
import {
|
||||
getPlPlanArchiveStatusLabel,
|
||||
getPlPlanArchiveStatusTagType
|
||||
@@ -242,8 +339,33 @@ const archiveDialogVisible = ref(false)
|
||||
const archivePlanId = ref('')
|
||||
const filterExpanded = ref(false)
|
||||
const planList = ref<Plan[]>([])
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'planDate', label: '计划日期' },
|
||||
{ prop: 'planType', label: '单据类型' },
|
||||
{ prop: 'customerName', label: '客户名称' },
|
||||
{ prop: 'products', label: '产品信息' },
|
||||
{ prop: 'archiveStatus', label: '归档状态' },
|
||||
{ prop: 'followStatus', label: '跟进状态' },
|
||||
{ prop: 'transportStatus', label: '运输状态' },
|
||||
{ prop: 'licensePlate', label: '车牌号' },
|
||||
{ prop: 'personnelSummary', label: '人员' },
|
||||
{ prop: 'followUserName', label: '跟进人', defaultVisible: false }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('pl-plan-archive-list-columns', listColumnDefs)
|
||||
|
||||
const selectedRows = ref<Plan[]>([])
|
||||
const viewingPlan = ref<Plan | null>(null)
|
||||
const selectedPlan = computed(() => (selectedRows.value.length === 1 ? selectedRows.value[0] : null))
|
||||
const dateRange = ref<string[]>([])
|
||||
const quickSearch = ref('')
|
||||
|
||||
const searchForm = reactive({
|
||||
planNo: '',
|
||||
@@ -296,12 +418,14 @@ function getFollowStatusLabel(status: string) {
|
||||
async function fetchData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const keyword = quickSearch.value.trim()
|
||||
const res = await planApi.list({
|
||||
planNo: searchForm.planNo || undefined,
|
||||
q: keyword || undefined,
|
||||
planNo: keyword ? undefined : searchForm.planNo || undefined,
|
||||
planType: searchForm.planType || undefined,
|
||||
followStatus: searchForm.followStatus || undefined,
|
||||
transportStatus: searchForm.transportStatus || undefined,
|
||||
customerName: searchForm.customerName || undefined,
|
||||
customerName: keyword ? undefined : searchForm.customerName || undefined,
|
||||
archiveStatus: searchForm.archiveStatus || undefined,
|
||||
planDateFrom: dateRange.value?.[0] || undefined,
|
||||
planDateTo: dateRange.value?.[1] || undefined,
|
||||
@@ -328,12 +452,30 @@ function handleReset() {
|
||||
searchForm.transportStatus = ''
|
||||
searchForm.customerName = ''
|
||||
searchForm.archiveStatus = ''
|
||||
dateRange.value = []
|
||||
quickSearch.value = ''
|
||||
resetDateShortcut()
|
||||
filterExpanded.value = false
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleQuickSearch() {
|
||||
searchForm.planNo = ''
|
||||
searchForm.customerName = ''
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleQuickSearchClear() {
|
||||
quickSearch.value = ''
|
||||
handleQuickSearch()
|
||||
}
|
||||
|
||||
const { activeDateShortcut, handleDateShortcut, resetDateShortcut } = useListDateShortcut(
|
||||
dateRange,
|
||||
handleSearch
|
||||
)
|
||||
|
||||
function handleSelectionChange(selection: Plan[]) {
|
||||
selectedRows.value = selection
|
||||
}
|
||||
@@ -348,10 +490,15 @@ function handleSizeChange() {
|
||||
}
|
||||
|
||||
function handleView(row: Plan) {
|
||||
viewingPlan.value = row
|
||||
viewPlanId.value = row.id
|
||||
viewVisible.value = true
|
||||
}
|
||||
|
||||
function archiveButtonLabel(row: Plan) {
|
||||
return row.archiveStatus === 'archived' ? '调整' : '归档'
|
||||
}
|
||||
|
||||
function handleEdit(row: Plan) {
|
||||
editingPlanId.value = row.id
|
||||
formDialogVisible.value = true
|
||||
@@ -362,6 +509,16 @@ function handleArchive(row: Plan) {
|
||||
archiveDialogVisible.value = true
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarArchive() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleArchive(selectedRows.value[0])
|
||||
}
|
||||
|
||||
useDbInstantSearch(
|
||||
() => ({
|
||||
planNo: searchForm.planNo,
|
||||
@@ -369,13 +526,30 @@ useDbInstantSearch(
|
||||
followStatus: searchForm.followStatus,
|
||||
transportStatus: searchForm.transportStatus,
|
||||
customerName: searchForm.customerName,
|
||||
archiveStatus: searchForm.archiveStatus,
|
||||
dateRange: dateRange.value
|
||||
archiveStatus: searchForm.archiveStatus
|
||||
}),
|
||||
handleSearch
|
||||
() => {
|
||||
quickSearch.value = ''
|
||||
handleSearch()
|
||||
}
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
fetchData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-list-toolbar-row {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.quick-search-input {
|
||||
width: 280px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.quick-search-icon {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -91,65 +91,152 @@
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row pl-plan-list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<ListToolbarDateShortcuts
|
||||
:active="activeDateShortcut"
|
||||
aria-label="计划日期快捷筛选"
|
||||
@change="handleDateShortcut"
|
||||
/>
|
||||
<el-input
|
||||
v-model="quickSearch"
|
||||
class="quick-search-input"
|
||||
placeholder="计划编号/客户名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuickSearch"
|
||||
@clear="handleQuickSearchClear"
|
||||
>
|
||||
<template #suffix>
|
||||
<el-icon class="quick-search-icon" @click="handleQuickSearch"><Search /></el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-button
|
||||
v-if="selectedPlan && canUploadCert(selectedPlan)"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarUploadCert"
|
||||
>
|
||||
<el-icon><Upload /></el-icon>上传证书
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="fetchData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 数据表格 -->
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="planList" v-loading="loading" stripe row-key="id">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="planList"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column prop="planNo" label="计划编号" min-width="180" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.planNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="planDate" label="计划日期" min-width="120" align="center" />
|
||||
<el-table-column prop="planType" label="单据类型" min-width="100" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('planDate')"
|
||||
prop="planDate"
|
||||
label="计划日期"
|
||||
min-width="120"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('planType')"
|
||||
prop="planType"
|
||||
label="单据类型"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getPlanTypeTagType(row.planType)" size="small">
|
||||
{{ getPlanTypeLabel(row.planType) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="customerName" label="客户名称" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="产品信息" min-width="240">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('customerName')"
|
||||
prop="customerName"
|
||||
label="客户名称"
|
||||
min-width="180"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column v-if="isColumnVisible('products')" label="产品信息" min-width="240">
|
||||
<template #default="{ row }">
|
||||
<PlPlanListProductCell :products="row.products" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计划附件" min-width="400">
|
||||
<el-table-column v-if="isColumnVisible('planAttachments')" label="计划附件" min-width="400">
|
||||
<template #default="{ row }">
|
||||
<PlPlanListCertCell :products="row.products" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="followStatus" label="跟进状态" min-width="100" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('followStatus')"
|
||||
prop="followStatus"
|
||||
label="跟进状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getFollowStatusTagType(row.followStatus)" size="small">
|
||||
{{ getFollowStatusLabel(row.followStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="transportStatus" label="运输状态" min-width="100" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('transportStatus')"
|
||||
prop="transportStatus"
|
||||
label="运输状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.transportStatus === 'arranged' ? 'success' : 'info'" size="small">
|
||||
{{ row.transportStatus === 'arranged' ? '已安排' : '待安排' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="licensePlate" label="车牌号" min-width="120" align="center" />
|
||||
<el-table-column prop="driverName" label="司机" min-width="100" align="center" />
|
||||
<el-table-column prop="followUserName" label="跟进人" min-width="100" align="center" />
|
||||
<el-table-column label="操作" min-width="260" fixed="right" align="center" class-name="col-actions">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
v-if="row.archiveStatus !== 'archived' && row.followStatus !== 'cancelled'"
|
||||
@click="handleUploadCert(row)"
|
||||
>
|
||||
<el-icon><Upload /></el-icon>上传证书
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('licensePlate')"
|
||||
prop="licensePlate"
|
||||
label="车牌号"
|
||||
min-width="120"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('personnelSummary')"
|
||||
prop="personnelSummary"
|
||||
label="人员"
|
||||
min-width="180"
|
||||
show-overflow-tooltip
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('followUserName')"
|
||||
prop="followUserName"
|
||||
label="跟进人"
|
||||
min-width="100"
|
||||
align="center"
|
||||
/>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -166,7 +253,18 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<PlPlanViewDialog v-model:visible="viewVisible" :plan-id="viewPlanId" />
|
||||
<PlPlanViewDialog v-model:visible="viewVisible" :plan-id="viewPlanId">
|
||||
<template v-if="viewingPlan" #hero-actions>
|
||||
<el-button
|
||||
v-if="canUploadCert(viewingPlan)"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleUploadCert(viewingPlan)"
|
||||
>
|
||||
<el-icon><Upload /></el-icon>上传证书
|
||||
</el-button>
|
||||
</template>
|
||||
</PlPlanViewDialog>
|
||||
|
||||
<PlPlanCertUploadDialog
|
||||
v-model:visible="certDialogVisible"
|
||||
@@ -182,15 +280,18 @@ import {
|
||||
ArrowUpBold,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
Upload,
|
||||
View
|
||||
Upload
|
||||
} from '@element-plus/icons-vue'
|
||||
import { planApi, type Plan } from '@/api/pl'
|
||||
import PlPlanCertUploadDialog from '@/components/business/pl-plan-cert-upload-dialog/index.vue'
|
||||
import PlPlanListCertCell from '@/components/business/pl-plan-list-cert-cell/index.vue'
|
||||
import PlPlanListProductCell from '@/components/business/pl-plan-list-product-cell/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import PlPlanViewDialog from '@/components/business/pl-plan-view-dialog/index.vue'
|
||||
import ListToolbarDateShortcuts from '@/components/core/list-toolbar-date-shortcuts/index.vue'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
import { useListDateShortcut } from '@/composables/useListDateShortcut'
|
||||
|
||||
const loading = ref(false)
|
||||
const viewVisible = ref(false)
|
||||
@@ -199,7 +300,33 @@ const certDialogVisible = ref(false)
|
||||
const certPlanId = ref('')
|
||||
const filterExpanded = ref(false)
|
||||
const planList = ref<Plan[]>([])
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'planDate', label: '计划日期' },
|
||||
{ prop: 'planType', label: '单据类型' },
|
||||
{ prop: 'customerName', label: '客户名称' },
|
||||
{ prop: 'products', label: '产品信息' },
|
||||
{ prop: 'planAttachments', label: '计划附件' },
|
||||
{ prop: 'followStatus', label: '跟进状态' },
|
||||
{ prop: 'transportStatus', label: '运输状态' },
|
||||
{ prop: 'licensePlate', label: '车牌号' },
|
||||
{ prop: 'personnelSummary', label: '人员' },
|
||||
{ prop: 'followUserName', label: '跟进人', defaultVisible: false }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('pl-plan-cert-list-columns', listColumnDefs)
|
||||
|
||||
const selectedRows = ref<Plan[]>([])
|
||||
const viewingPlan = ref<Plan | null>(null)
|
||||
const selectedPlan = computed(() => (selectedRows.value.length === 1 ? selectedRows.value[0] : null))
|
||||
const dateRange = ref<string[]>([])
|
||||
const quickSearch = ref('')
|
||||
|
||||
const searchForm = reactive({
|
||||
planNo: '',
|
||||
@@ -251,12 +378,14 @@ function getFollowStatusLabel(status: string) {
|
||||
async function fetchData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const keyword = quickSearch.value.trim()
|
||||
const res = await planApi.list({
|
||||
planNo: searchForm.planNo || undefined,
|
||||
q: keyword || undefined,
|
||||
planNo: keyword ? undefined : searchForm.planNo || undefined,
|
||||
planType: searchForm.planType || undefined,
|
||||
followStatus: searchForm.followStatus || undefined,
|
||||
transportStatus: searchForm.transportStatus || undefined,
|
||||
customerName: searchForm.customerName || undefined,
|
||||
customerName: keyword ? undefined : searchForm.customerName || undefined,
|
||||
planDateFrom: dateRange.value?.[0] || undefined,
|
||||
planDateTo: dateRange.value?.[1] || undefined,
|
||||
page: pagination.page,
|
||||
@@ -281,12 +410,30 @@ function handleReset() {
|
||||
searchForm.followStatus = ''
|
||||
searchForm.transportStatus = ''
|
||||
searchForm.customerName = ''
|
||||
dateRange.value = []
|
||||
quickSearch.value = ''
|
||||
resetDateShortcut()
|
||||
filterExpanded.value = false
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleQuickSearch() {
|
||||
searchForm.planNo = ''
|
||||
searchForm.customerName = ''
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleQuickSearchClear() {
|
||||
quickSearch.value = ''
|
||||
handleQuickSearch()
|
||||
}
|
||||
|
||||
const { activeDateShortcut, handleDateShortcut, resetDateShortcut } = useListDateShortcut(
|
||||
dateRange,
|
||||
handleSearch
|
||||
)
|
||||
|
||||
function handlePageChange() {
|
||||
fetchData()
|
||||
}
|
||||
@@ -296,7 +443,16 @@ function handleSizeChange() {
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleSelectionChange(selection: Plan[]) {
|
||||
selectedRows.value = selection
|
||||
}
|
||||
|
||||
function canUploadCert(row: Plan) {
|
||||
return row.archiveStatus !== 'archived' && row.followStatus !== 'cancelled'
|
||||
}
|
||||
|
||||
function handleView(row: Plan) {
|
||||
viewingPlan.value = row
|
||||
viewPlanId.value = row.id
|
||||
viewVisible.value = true
|
||||
}
|
||||
@@ -306,19 +462,41 @@ function handleUploadCert(row: Plan) {
|
||||
certDialogVisible.value = true
|
||||
}
|
||||
|
||||
function handleToolbarUploadCert() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleUploadCert(selectedRows.value[0])
|
||||
}
|
||||
|
||||
useDbInstantSearch(
|
||||
() => ({
|
||||
planNo: searchForm.planNo,
|
||||
planType: searchForm.planType,
|
||||
followStatus: searchForm.followStatus,
|
||||
transportStatus: searchForm.transportStatus,
|
||||
customerName: searchForm.customerName,
|
||||
dateRange: dateRange.value
|
||||
customerName: searchForm.customerName
|
||||
}),
|
||||
handleSearch
|
||||
() => {
|
||||
quickSearch.value = ''
|
||||
handleSearch()
|
||||
}
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
fetchData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-list-toolbar-row {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.quick-search-input {
|
||||
width: 280px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.quick-search-icon {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -93,23 +93,74 @@
|
||||
|
||||
<!-- 工具栏 -->
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-row pl-plan-list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<ListToolbarDateShortcuts
|
||||
:active="activeDateShortcut"
|
||||
aria-label="计划日期快捷筛选"
|
||||
@change="handleDateShortcut"
|
||||
/>
|
||||
<el-input
|
||||
v-model="quickSearch"
|
||||
class="quick-search-input"
|
||||
placeholder="计划编号/客户名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuickSearch"
|
||||
@clear="handleQuickSearchClear"
|
||||
>
|
||||
<template #suffix>
|
||||
<el-icon class="quick-search-icon" @click="handleQuickSearch"><Search /></el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增计划
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedPlan && selectedPlan.archiveStatus !== 'archived'"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedPlan && selectedPlan.archiveStatus !== 'archived' && selectedPlan.followStatus !== 'cancelled'"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarUploadCert"
|
||||
>
|
||||
<el-icon><Upload /></el-icon>上传证书
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedPlan && canArrangeTransport(selectedPlan)"
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarArrange"
|
||||
>
|
||||
<el-icon><Van /></el-icon>{{ arrangeTransportLabel(selectedPlan) }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedPlan && canVoidPlan(selectedPlan)"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="multiple || !allRowsDeletableByCreator(selectedRows)"
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
:loading="deleteLoading"
|
||||
@click="handleBatchDelete"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
:loading="voidLoading"
|
||||
@click="handleToolbarVoid"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>批量删除
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="fetchData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -122,6 +173,7 @@
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column prop="planNo" label="计划编号" min-width="180" show-overflow-tooltip>
|
||||
@@ -129,85 +181,91 @@
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.planNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="planDate" label="计划日期" min-width="120" align="center" />
|
||||
<el-table-column prop="planType" label="单据类型" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getPlanTypeTagType(row.planType)" size="small">
|
||||
{{ getPlanTypeLabel(row.planType) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="customerName" label="客户名称" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="产品信息" min-width="240">
|
||||
<template #default="{ row }">
|
||||
<PlPlanListProductCell :products="row.products" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="计划附件" min-width="400">
|
||||
<template #default="{ row }">
|
||||
<PlPlanListCertCell :products="row.products" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="followStatus" label="跟进状态" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getFollowStatusTagType(row.followStatus)" size="small">
|
||||
{{ getFollowStatusLabel(row.followStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="transportStatus" label="运输状态" min-width="100" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('transportStatus')"
|
||||
prop="transportStatus"
|
||||
label="运输状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.transportStatus === 'arranged' ? 'success' : 'info'" size="small">
|
||||
{{ row.transportStatus === 'arranged' ? '已安排' : '待安排' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="licensePlate" label="车牌号" min-width="120" align="center" />
|
||||
<el-table-column prop="driverName" label="司机" min-width="100" align="center" />
|
||||
<el-table-column prop="followUserName" label="跟进人" min-width="100" align="center" />
|
||||
<el-table-column label="操作" min-width="520" fixed="right" align="center" class-name="col-actions">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('followStatus')"
|
||||
prop="followStatus"
|
||||
label="跟进状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button link type="primary" @click="handleEdit(row)" v-if="row.archiveStatus !== 'archived'">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
v-if="row.archiveStatus !== 'archived' && row.followStatus !== 'cancelled'"
|
||||
@click="handleUploadCert(row)"
|
||||
>
|
||||
<el-icon><Upload /></el-icon>上传证书
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="success"
|
||||
v-if="canArrangeTransport(row)"
|
||||
@click="handleArrange(row)"
|
||||
>
|
||||
<el-icon><Van /></el-icon>{{ arrangeTransportLabel(row) }}
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
v-if="canVoidPlan(row)"
|
||||
@click="handleVoid(row)"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
<el-tag :type="getFollowStatusTagType(row.followStatus)" size="small">
|
||||
{{ getFollowStatusLabel(row.followStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('planDate')"
|
||||
prop="planDate"
|
||||
label="计划日期"
|
||||
min-width="120"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('planType')"
|
||||
prop="planType"
|
||||
label="单据类型"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getPlanTypeTagType(row.planType)" size="small">
|
||||
{{ getPlanTypeLabel(row.planType) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('customerName')"
|
||||
prop="customerName"
|
||||
label="客户名称"
|
||||
min-width="180"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column v-if="isColumnVisible('products')" label="产品信息" min-width="240">
|
||||
<template #default="{ row }">
|
||||
<PlPlanListProductCell :products="row.products" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="isColumnVisible('planAttachments')" label="计划附件" min-width="240">
|
||||
<template #default="{ row }">
|
||||
<PlPlanListCertCell :products="row.products" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('licensePlate')"
|
||||
prop="licensePlate"
|
||||
label="车牌号"
|
||||
min-width="120"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('personnelSummary')"
|
||||
prop="personnelSummary"
|
||||
label="人员"
|
||||
min-width="180"
|
||||
show-overflow-tooltip
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('followUserName')"
|
||||
prop="followUserName"
|
||||
label="跟进人"
|
||||
min-width="100"
|
||||
align="center"
|
||||
/>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -230,7 +288,41 @@
|
||||
@success="fetchData"
|
||||
/>
|
||||
|
||||
<PlPlanViewDialog v-model:visible="viewVisible" :plan-id="viewPlanId" />
|
||||
<PlPlanViewDialog v-model:visible="viewVisible" :plan-id="viewPlanId">
|
||||
<template v-if="viewingPlan" #hero-actions>
|
||||
<el-button
|
||||
v-if="viewingPlan.archiveStatus !== 'archived'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleEdit(viewingPlan)"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="viewingPlan.archiveStatus !== 'archived' && viewingPlan.followStatus !== 'cancelled'"
|
||||
class="btn-ghost"
|
||||
@click="handleUploadCert(viewingPlan)"
|
||||
>
|
||||
<el-icon><Upload /></el-icon>上传证书
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canArrangeTransport(viewingPlan)"
|
||||
class="btn-ghost"
|
||||
@click="handleArrange(viewingPlan)"
|
||||
>
|
||||
<el-icon><Van /></el-icon>{{ arrangeTransportLabel(viewingPlan) }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canVoidPlan(viewingPlan)"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:loading="voidLoading"
|
||||
@click="handleVoid(viewingPlan)"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
</template>
|
||||
</PlPlanViewDialog>
|
||||
|
||||
<PlPlanCertUploadDialog
|
||||
v-model:visible="certDialogVisible"
|
||||
@@ -251,29 +343,29 @@ import {
|
||||
ArrowDownBold,
|
||||
ArrowUpBold,
|
||||
CircleClose,
|
||||
Delete,
|
||||
Edit,
|
||||
Plus,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
Upload,
|
||||
Van,
|
||||
View
|
||||
Van
|
||||
} from '@element-plus/icons-vue'
|
||||
import { planApi, type Plan } from '@/api/pl'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import PlPlanArrangeDialog from '@/components/business/pl-plan-arrange-dialog/index.vue'
|
||||
import PlPlanCertUploadDialog from '@/components/business/pl-plan-cert-upload-dialog/index.vue'
|
||||
import PlPlanFormDialog from '@/components/business/pl-plan-form-dialog/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import PlPlanListCertCell from '@/components/business/pl-plan-list-cert-cell/index.vue'
|
||||
import PlPlanListProductCell from '@/components/business/pl-plan-list-product-cell/index.vue'
|
||||
import PlPlanViewDialog from '@/components/business/pl-plan-view-dialog/index.vue'
|
||||
import ListToolbarDateShortcuts from '@/components/core/list-toolbar-date-shortcuts/index.vue'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
import { useListDateShortcut } from '@/composables/useListDateShortcut'
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const loading = ref(false)
|
||||
const deleteLoading = ref(false)
|
||||
const voidLoading = ref(false)
|
||||
const formDialogVisible = ref(false)
|
||||
const editingPlanId = ref('')
|
||||
@@ -285,8 +377,33 @@ const arrangeDialogVisible = ref(false)
|
||||
const arrangePlanId = ref('')
|
||||
const filterExpanded = ref(false)
|
||||
const planList = ref<Plan[]>([])
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'transportStatus', label: '运输状态' },
|
||||
{ prop: 'followStatus', label: '跟进状态' },
|
||||
{ prop: 'planDate', label: '计划日期' },
|
||||
{ prop: 'planType', label: '单据类型' },
|
||||
{ prop: 'customerName', label: '客户名称' },
|
||||
{ prop: 'products', label: '产品信息' },
|
||||
{ prop: 'planAttachments', label: '计划附件' },
|
||||
{ prop: 'licensePlate', label: '车牌号' },
|
||||
{ prop: 'personnelSummary', label: '人员' },
|
||||
{ prop: 'followUserName', label: '跟进人', defaultVisible: false }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('pl-plan-list-columns', listColumnDefs)
|
||||
|
||||
const selectedRows = ref<Plan[]>([])
|
||||
const viewingPlan = ref<Plan | null>(null)
|
||||
const selectedPlan = computed(() => (selectedRows.value.length === 1 ? selectedRows.value[0] : null))
|
||||
const dateRange = ref<string[]>([])
|
||||
const quickSearch = ref('')
|
||||
|
||||
const searchForm = reactive({
|
||||
planNo: '',
|
||||
@@ -302,8 +419,6 @@ const pagination = reactive({
|
||||
total: 0
|
||||
})
|
||||
|
||||
const multiple = computed(() => selectedRows.value.length === 0)
|
||||
|
||||
const PLAN_FILTER_FIELD_COUNT = 6
|
||||
const showFilterToggle = computed(() => PLAN_FILTER_FIELD_COUNT > 4)
|
||||
|
||||
@@ -340,12 +455,14 @@ function getFollowStatusLabel(status: string) {
|
||||
async function fetchData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const keyword = quickSearch.value.trim()
|
||||
const res = await planApi.list({
|
||||
planNo: searchForm.planNo || undefined,
|
||||
q: keyword || undefined,
|
||||
planNo: keyword ? undefined : searchForm.planNo || undefined,
|
||||
planType: searchForm.planType || undefined,
|
||||
followStatus: searchForm.followStatus || undefined,
|
||||
transportStatus: searchForm.transportStatus || undefined,
|
||||
customerName: searchForm.customerName || undefined,
|
||||
customerName: keyword ? undefined : searchForm.customerName || undefined,
|
||||
planDateFrom: dateRange.value?.[0] || undefined,
|
||||
planDateTo: dateRange.value?.[1] || undefined,
|
||||
page: pagination.page,
|
||||
@@ -370,16 +487,30 @@ function handleReset() {
|
||||
searchForm.followStatus = ''
|
||||
searchForm.transportStatus = ''
|
||||
searchForm.customerName = ''
|
||||
dateRange.value = []
|
||||
quickSearch.value = ''
|
||||
resetDateShortcut()
|
||||
filterExpanded.value = false
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleSelectionChange(selection: Plan[]) {
|
||||
selectedRows.value = selection
|
||||
function handleQuickSearch() {
|
||||
searchForm.planNo = ''
|
||||
searchForm.customerName = ''
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleQuickSearchClear() {
|
||||
quickSearch.value = ''
|
||||
handleQuickSearch()
|
||||
}
|
||||
|
||||
const { activeDateShortcut, handleDateShortcut, resetDateShortcut } = useListDateShortcut(
|
||||
dateRange,
|
||||
handleSearch
|
||||
)
|
||||
|
||||
function handlePageChange() {
|
||||
fetchData()
|
||||
}
|
||||
@@ -394,7 +525,12 @@ function handleAdd() {
|
||||
formDialogVisible.value = true
|
||||
}
|
||||
|
||||
function handleSelectionChange(selection: Plan[]) {
|
||||
selectedRows.value = selection
|
||||
}
|
||||
|
||||
function handleView(row: Plan) {
|
||||
viewingPlan.value = row
|
||||
viewPlanId.value = row.id
|
||||
viewVisible.value = true
|
||||
}
|
||||
@@ -449,48 +585,24 @@ function handleArrange(row: Plan) {
|
||||
arrangeDialogVisible.value = true
|
||||
}
|
||||
|
||||
async function handleDelete(row: Plan) {
|
||||
if (!canDeleteByCreator(row)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
await ElMessageBox.confirm(`确定删除运输计划「${row.planNo}」吗?`, '提示', { type: 'warning' })
|
||||
deleteLoading.value = true
|
||||
try {
|
||||
await planApi.delete(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
selectedRows.value = selectedRows.value.filter(item => item.id !== row.id)
|
||||
fetchData()
|
||||
} finally {
|
||||
deleteLoading.value = false
|
||||
}
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleBatchDelete() {
|
||||
const deletable = filterDeletableByCreator(selectedRows.value)
|
||||
if (!deletable.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
if (deletable.length < selectedRows.value.length) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
const ids = deletable.map(r => r.id)
|
||||
await ElMessageBox.confirm(`确定删除选中的 ${ids.length} 条运输计划吗?`, '提示', {
|
||||
type: 'warning'
|
||||
})
|
||||
deleteLoading.value = true
|
||||
try {
|
||||
for (const id of ids) {
|
||||
await planApi.delete(id)
|
||||
}
|
||||
ElMessage.success('批量删除成功')
|
||||
selectedRows.value = []
|
||||
fetchData()
|
||||
} finally {
|
||||
deleteLoading.value = false
|
||||
}
|
||||
function handleToolbarUploadCert() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleUploadCert(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarArrange() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleArrange(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarVoid() {
|
||||
if (selectedRows.value.length !== 1) return
|
||||
handleVoid(selectedRows.value[0])
|
||||
}
|
||||
|
||||
useDbInstantSearch(
|
||||
@@ -499,10 +611,12 @@ useDbInstantSearch(
|
||||
planType: searchForm.planType,
|
||||
followStatus: searchForm.followStatus,
|
||||
transportStatus: searchForm.transportStatus,
|
||||
customerName: searchForm.customerName,
|
||||
dateRange: dateRange.value
|
||||
customerName: searchForm.customerName
|
||||
}),
|
||||
handleSearch
|
||||
() => {
|
||||
quickSearch.value = ''
|
||||
handleSearch()
|
||||
}
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
@@ -518,3 +632,18 @@ function openArrangeFromQuery() {
|
||||
router.replace({ path: '/pl/plan' })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.pl-plan-list-toolbar-row {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.quick-search-input {
|
||||
width: 280px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.quick-search-icon {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -56,70 +56,124 @@
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增自有车辆
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="fetchData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap vehicle-card-wrap" v-loading="loading">
|
||||
<p v-if="!vehicleList.length && !loading" class="vehicle-card-empty">暂无自有车辆</p>
|
||||
|
||||
<div v-else class="vehicle-card-grid">
|
||||
<article
|
||||
v-for="row in vehicleList"
|
||||
:key="row.id"
|
||||
class="vehicle-card"
|
||||
:class="{ 'is-selected': isSelected(row) }"
|
||||
@dblclick="handleView(row)"
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="vehicleList"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="licensePlate"
|
||||
label="车牌号"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<div class="vehicle-card-head">
|
||||
<el-checkbox
|
||||
:model-value="isSelected(row)"
|
||||
@change="(checked: boolean) => toggleSelect(row, checked)"
|
||||
@click.stop
|
||||
/>
|
||||
<div class="vehicle-card-title">
|
||||
<span class="vehicle-card-name">{{ row.licensePlate }}</span>
|
||||
<el-tag type="success" size="small">自有</el-tag>
|
||||
<el-tag :type="getStatusTagType(row.vehicleStatus)" size="small">
|
||||
{{ getStatusLabel(row.vehicleStatus) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.licensePlate }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="车辆类型" min-width="90" align="center" header-align="center" v-if="isColumnVisible('vehicleType')">
|
||||
<template #default>
|
||||
<el-tag type="success" size="small">自有</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="车辆状态" min-width="100" align="center" header-align="center" v-if="isColumnVisible('vehicleStatus')">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getStatusTagType(row.vehicleStatus)" size="small">
|
||||
{{ getStatusLabel(row.vehicleStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('trailerNo')"
|
||||
prop="trailerNo"
|
||||
label="挂车号"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('loadCapacity')"
|
||||
prop="loadCapacity"
|
||||
label="载重(吨)"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('carrierName')"
|
||||
prop="carrierName"
|
||||
label="承运商"
|
||||
min-width="140"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('personnelSummary')"
|
||||
prop="personnelSummary"
|
||||
label="关联人员"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('remark')"
|
||||
prop="remark"
|
||||
label="备注"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
</el-table>
|
||||
|
||||
<dl class="vehicle-card-kv">
|
||||
<div class="vehicle-card-kv-item">
|
||||
<dt>挂车号</dt>
|
||||
<dd>{{ row.trailerNo || '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-card-kv-item">
|
||||
<dt>载重(吨)</dt>
|
||||
<dd>{{ row.loadCapacity || '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-card-kv-item">
|
||||
<dt>承运商</dt>
|
||||
<dd>{{ row.carrierName || '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-card-kv-item">
|
||||
<dt>关联人员</dt>
|
||||
<dd>{{ row.personnelSummary || '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-card-kv-item">
|
||||
<dt>备注</dt>
|
||||
<dd>{{ row.remark || '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div class="vehicle-card-actions">
|
||||
<el-button link type="primary" @click.stop="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button link type="primary" @click.stop="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" :disabled="!canDeleteByCreator(row)" :title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP" @click.stop="handleDelete(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</article>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -273,6 +327,20 @@
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
>
|
||||
<template v-if="viewDetail" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEditFromView">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewDetail)"
|
||||
:title="canDeleteByCreator(viewDetail) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDeleteFromView"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</template>
|
||||
<template #vehicleDetailTabs>
|
||||
<PlVehicleCertPersonnelTabs
|
||||
:cert-list="viewDetail?.certList || []"
|
||||
@@ -286,7 +354,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close, Delete, Edit, Plus, RefreshLeft, Search, Van, View } from '@element-plus/icons-vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { Check, Close, Delete, Edit, Plus, RefreshLeft, Search, Van } from '@element-plus/icons-vue'
|
||||
import {
|
||||
vehicleApi,
|
||||
personnelApi,
|
||||
@@ -306,6 +376,8 @@ import SystemViewDialog, {
|
||||
} from '@/components/business/system-view-dialog/index.vue'
|
||||
import { loadPersonnelWithCerts } from '@/composables/usePlVehicleViewDetail'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
import { pickBxList, pickBxPageResult } from '@/utils/http/bx'
|
||||
import { DEFAULT_LIST_PAGE_SIZE } from '@/utils/table/tableConfig'
|
||||
import { formatDateTime } from '@/utils/format'
|
||||
import {
|
||||
getPlVehicleStatusLabel,
|
||||
@@ -327,6 +399,25 @@ const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const vehicleList = ref<Vehicle[]>([])
|
||||
const carrierList = ref<Carrier[]>([])
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'vehicleType', label: '车辆类型' },
|
||||
{ prop: 'vehicleStatus', label: '车辆状态' },
|
||||
{ prop: 'trailerNo', label: '挂车号' },
|
||||
{ prop: 'loadCapacity', label: '载重(吨)' },
|
||||
{ prop: 'carrierName', label: '承运商', defaultVisible: false },
|
||||
{ prop: 'personnelSummary', label: '关联人员' },
|
||||
{ prop: 'remark', label: '备注', defaultVisible: false }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('pl-self-vehicle-list-columns', listColumnDefs)
|
||||
|
||||
const personnelOptions = ref<Personnel[]>([])
|
||||
const selectedRows = ref<Vehicle[]>([])
|
||||
const dialogVisible = ref(false)
|
||||
@@ -350,6 +441,12 @@ const searchForm = reactive({
|
||||
carrierId: ''
|
||||
})
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
pageSize: DEFAULT_LIST_PAGE_SIZE,
|
||||
total: 0
|
||||
})
|
||||
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
licensePlate: '',
|
||||
@@ -494,8 +591,13 @@ function resolvePersonnelRows(rows: VehiclePersonnelRow[]) {
|
||||
}
|
||||
|
||||
async function loadPersonnelOptions() {
|
||||
const res = await personnelApi.list({ status: '1' })
|
||||
personnelOptions.value = (res.data ?? res) || []
|
||||
const res = await personnelApi.list({ status: '1', pageSize: 100 })
|
||||
personnelOptions.value = pickBxList<Personnel>(res)
|
||||
}
|
||||
|
||||
async function loadCarrierOptions() {
|
||||
const res = await carrierApi.list({ page: 1, pageSize: 100 })
|
||||
carrierList.value = pickBxList<Carrier>(res)
|
||||
}
|
||||
|
||||
function handleAddPersonnel() {
|
||||
@@ -560,17 +662,17 @@ function validateSubTables(): boolean {
|
||||
async function fetchData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const [vehicleRes, carrierRes] = await Promise.all([
|
||||
vehicleApi.list({
|
||||
vehicleType: VEHICLE_TYPE_SELF,
|
||||
q: searchForm.q || undefined,
|
||||
vehicleStatus: searchForm.vehicleStatus || undefined,
|
||||
carrierId: searchForm.carrierId || undefined
|
||||
}),
|
||||
carrierApi.list()
|
||||
])
|
||||
vehicleList.value = (vehicleRes.data ?? vehicleRes) || []
|
||||
carrierList.value = (carrierRes.data ?? carrierRes) || []
|
||||
const res = await vehicleApi.list({
|
||||
vehicleType: VEHICLE_TYPE_SELF,
|
||||
q: searchForm.q || undefined,
|
||||
vehicleStatus: searchForm.vehicleStatus || undefined,
|
||||
carrierId: searchForm.carrierId || undefined,
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
const { list, total } = pickBxPageResult<Vehicle>(res)
|
||||
vehicleList.value = list
|
||||
pagination.total = total
|
||||
const idSet = new Set(vehicleList.value.map(item => item.id))
|
||||
selectedRows.value = selectedRows.value.filter(item => idSet.has(item.id))
|
||||
} finally {
|
||||
@@ -579,6 +681,7 @@ async function fetchData() {
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
@@ -587,21 +690,48 @@ function handleReset() {
|
||||
searchForm.vehicleStatus = ''
|
||||
searchForm.carrierId = ''
|
||||
selectedRows.value = []
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function isSelected(row: Vehicle) {
|
||||
return selectedRows.value.some(item => item.id === row.id)
|
||||
function handlePageChange() {
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function toggleSelect(row: Vehicle, checked: boolean) {
|
||||
if (checked) {
|
||||
if (!isSelected(row)) {
|
||||
selectedRows.value = [...selectedRows.value, row]
|
||||
}
|
||||
function handleSizeChange() {
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: Vehicle[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条车辆记录')
|
||||
return
|
||||
}
|
||||
selectedRows.value = selectedRows.value.filter(item => item.id !== row.id)
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条车辆记录')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleEditFromView() {
|
||||
if (!viewDetail.value) return
|
||||
viewVisible.value = false
|
||||
handleEdit(viewDetail.value)
|
||||
}
|
||||
|
||||
async function handleDeleteFromView() {
|
||||
if (!viewDetail.value) return
|
||||
await handleDelete(viewDetail.value)
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
@@ -758,6 +888,10 @@ async function handleDelete(row: Vehicle) {
|
||||
await ElMessageBox.confirm('确定删除该自有车辆吗?', '提示', { type: 'warning' })
|
||||
await vehicleApi.delete(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
if (viewDetail.value?.id === row.id) {
|
||||
viewVisible.value = false
|
||||
viewDetail.value = null
|
||||
}
|
||||
fetchData()
|
||||
}
|
||||
|
||||
@@ -770,126 +904,12 @@ useDbInstantSearch(
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
loadCarrierOptions()
|
||||
fetchData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.vehicle-card-wrap {
|
||||
min-height: 120px;
|
||||
padding: 16px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.vehicle-card-empty {
|
||||
margin: 0;
|
||||
padding: 24px 0;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.vehicle-card-grid {
|
||||
display: grid;
|
||||
width: 100%;
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
|
||||
gap: 16px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.vehicle-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
height: 100%;
|
||||
min-height: 220px;
|
||||
padding: 16px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
||||
transition:
|
||||
border-color 0.2s ease,
|
||||
box-shadow 0.2s ease,
|
||||
background-color 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: #a7f3d0;
|
||||
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
|
||||
}
|
||||
|
||||
&.is-selected {
|
||||
border-color: #10b981;
|
||||
background: #ecfdf5;
|
||||
}
|
||||
}
|
||||
|
||||
.vehicle-card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.vehicle-card-title {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.vehicle-card-name {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.vehicle-card-kv {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 10px;
|
||||
margin: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.vehicle-card-kv-item {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
font-size: 13px;
|
||||
|
||||
dt {
|
||||
margin: 0;
|
||||
color: #1e293b;
|
||||
font-weight: 500;
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
color: #1e293b;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.vehicle-card-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 4px 8px;
|
||||
padding-top: 12px;
|
||||
margin-top: auto;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.sub-table-section {
|
||||
margin-top: 16px;
|
||||
grid-column: 1 / -1;
|
||||
@@ -911,15 +931,4 @@ onMounted(() => {
|
||||
.sub-table {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.vehicle-card-wrap {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.vehicle-card-grid {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -50,7 +50,28 @@
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">已选 <span class="sel-num">0</span> 项</div>
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="!canToolbarQrcode"
|
||||
:loading="qrcodeLoading"
|
||||
@click="handleToolbarQrcode"
|
||||
>
|
||||
<el-icon><Share /></el-icon>二维码
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="fetchData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -61,57 +82,105 @@
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column prop="transportNo" label="运输编号" min-width="180" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.transportNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="licensePlate" label="车牌号" min-width="120" align="center" />
|
||||
<el-table-column prop="driverName" label="司机" min-width="100" align="center" />
|
||||
<el-table-column prop="carrierName" label="承运商" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column prop="transportMedium" label="运输介质" min-width="120" align="center" />
|
||||
<el-table-column prop="startPoint" label="起点" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="endPoint" label="终点" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="freightAmount" label="运费(元)" min-width="100" align="right">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('licensePlate')"
|
||||
prop="licensePlate"
|
||||
label="车牌号"
|
||||
min-width="120"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('driverName')"
|
||||
prop="driverName"
|
||||
label="司机"
|
||||
min-width="100"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('carrierName')"
|
||||
prop="carrierName"
|
||||
label="承运商"
|
||||
min-width="160"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('transportMedium')"
|
||||
prop="transportMedium"
|
||||
label="运输介质"
|
||||
min-width="120"
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('startPoint')"
|
||||
prop="startPoint"
|
||||
label="起点"
|
||||
min-width="150"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('endPoint')"
|
||||
prop="endPoint"
|
||||
label="终点"
|
||||
min-width="150"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('freightAmount')"
|
||||
prop="freightAmount"
|
||||
label="运费(元)"
|
||||
min-width="100"
|
||||
align="right"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatAmount(row.freightAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="transportStatus" label="运输状态" min-width="100" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('transportStatus')"
|
||||
prop="transportStatus"
|
||||
label="运输状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getTransportStatusTagType(row.transportStatus)" size="small">
|
||||
{{ getTransportStatusLabel(row.transportStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="approvalStatus" label="审批状态" min-width="100" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('approvalStatus')"
|
||||
prop="approvalStatus"
|
||||
label="审批状态"
|
||||
min-width="100"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getApprovalStatusTagType(row.approvalStatus)" size="small">
|
||||
{{ getApprovalStatusLabel(row.approvalStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" min-width="160" align="center">
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('createTime')"
|
||||
prop="createTime"
|
||||
label="创建时间"
|
||||
min-width="160"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ formatDateTime(row.createTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="200" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.approvalStatus === 'approved'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleQrcode(row)"
|
||||
>
|
||||
<el-icon><Share /></el-icon>二维码
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -140,26 +209,73 @@
|
||||
width="720px"
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
/>
|
||||
>
|
||||
<template v-if="currentTransport?.approvalStatus === 'approved'" #hero-actions>
|
||||
<div class="transport-view-hero-actions">
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:loading="qrcodeLoading"
|
||||
@click="handleViewQrcode"
|
||||
>
|
||||
<el-icon><Share /></el-icon>二维码
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RefreshLeft, Search, Share, Van, View } from '@element-plus/icons-vue'
|
||||
import { RefreshLeft, Search, Share, Van } from '@element-plus/icons-vue'
|
||||
import SystemViewDialog, {
|
||||
type ViewSection
|
||||
} from '@/components/business/system-view-dialog/index.vue'
|
||||
import { transportApi, type Transport } from '@/api/pl'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { formatDateTime } from '@/utils/format'
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'licensePlate', label: '车牌号' },
|
||||
{ prop: 'driverName', label: '司机' },
|
||||
{ prop: 'carrierName', label: '承运商' },
|
||||
{ prop: 'transportMedium', label: '运输介质' },
|
||||
{ prop: 'startPoint', label: '起点' },
|
||||
{ prop: 'endPoint', label: '终点' },
|
||||
{ prop: 'freightAmount', label: '运费(元)' },
|
||||
{ prop: 'transportStatus', label: '运输状态' },
|
||||
{ prop: 'approvalStatus', label: '审批状态' },
|
||||
{ prop: 'createTime', label: '创建时间' }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('pl-transport-list-columns', listColumnDefs)
|
||||
|
||||
const detailLoading = ref(false)
|
||||
const qrcodeLoading = ref(false)
|
||||
const transportList = ref<Transport[]>([])
|
||||
const selectedRows = ref<Transport[]>([])
|
||||
const detailVisible = ref(false)
|
||||
const currentTransport = ref<Transport | null>(null)
|
||||
|
||||
const selectedRow = computed(() =>
|
||||
selectedRows.value.length === 1 ? selectedRows.value[0] : null
|
||||
)
|
||||
|
||||
const canToolbarQrcode = computed(
|
||||
() => selectedRow.value?.approvalStatus === 'approved'
|
||||
)
|
||||
|
||||
const searchForm = reactive({
|
||||
transportNo: '',
|
||||
transportStatus: '',
|
||||
@@ -324,6 +440,10 @@ function handleSizeChange() {
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: Transport[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
async function handleView(row: Transport) {
|
||||
detailVisible.value = true
|
||||
detailLoading.value = true
|
||||
@@ -337,6 +457,7 @@ async function handleView(row: Transport) {
|
||||
}
|
||||
|
||||
async function handleQrcode(row: Transport) {
|
||||
qrcodeLoading.value = true
|
||||
try {
|
||||
const res = await transportApi.generateQrcode(row.id)
|
||||
const payload = res.data ?? res
|
||||
@@ -346,9 +467,21 @@ async function handleQrcode(row: Transport) {
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
} finally {
|
||||
qrcodeLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarQrcode() {
|
||||
if (!selectedRow.value || !canToolbarQrcode.value) return
|
||||
handleQrcode(selectedRow.value)
|
||||
}
|
||||
|
||||
function handleViewQrcode() {
|
||||
if (!currentTransport.value) return
|
||||
handleQrcode(currentTransport.value)
|
||||
}
|
||||
|
||||
useDbInstantSearch(
|
||||
() => ({
|
||||
transportNo: searchForm.transportNo,
|
||||
@@ -362,3 +495,11 @@ onMounted(() => {
|
||||
fetchData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.transport-view-hero-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -70,6 +70,24 @@
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增申请
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1 || selectedRows[0].status !== 'pending'"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="warning"
|
||||
:disabled="selectedRows.length !== 1 || selectedRows[0].status !== 'pending'"
|
||||
:loading="selectedRows.length === 1 && cancelLoadingMap[selectedRows[0].id]"
|
||||
@click="handleToolbarCancel"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -81,9 +99,14 @@
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column prop="applyNo" label="申请单号" min-width="170" show-overflow-tooltip />
|
||||
<el-table-column prop="applyNo" label="申请单号" min-width="170" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.applyNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="licensePlate" label="车牌号" min-width="120" align="center" />
|
||||
<el-table-column prop="maintenanceType" label="维保类型" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
@@ -106,24 +129,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center" />
|
||||
<el-table-column label="操作" min-width="280" fixed="right" align="center" class-name="col-actions">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<template v-if="row.status === 'pending'">
|
||||
<el-button link type="primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button link type="warning" :loading="cancelLoadingMap[row.id]" @click="handleCancel(row)">
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
<el-button link type="danger" :loading="deleteLoadingMap[row.id]" @click="handleDelete(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -268,21 +273,34 @@
|
||||
width="720px"
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
/>
|
||||
>
|
||||
<template v-if="viewingRecord?.status === 'pending'" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRecord!)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="warning"
|
||||
:loading="cancelLoadingMap[viewingRecord!.id]"
|
||||
@click="handleViewCancel"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import {
|
||||
Check,
|
||||
CircleClose,
|
||||
Close,
|
||||
Delete,
|
||||
Edit,
|
||||
Plus,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
View
|
||||
Search
|
||||
} from '@element-plus/icons-vue'
|
||||
import {
|
||||
vehicleApi,
|
||||
@@ -290,6 +308,7 @@ import {
|
||||
type Vehicle,
|
||||
type VehicleMaintenanceApply
|
||||
} from '@/api/pl'
|
||||
import { pickBxList } from '@/utils/http/bx'
|
||||
import { fetchUserOptions } from '@/api/admin'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import SystemViewDialog, { type ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
@@ -316,7 +335,6 @@ const userOptions = ref<
|
||||
const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const cancelLoadingMap = reactive<Record<string, boolean>>({})
|
||||
const deleteLoadingMap = reactive<Record<string, boolean>>({})
|
||||
const tableData = ref<VehicleMaintenanceApply[]>([])
|
||||
const selectedRows = ref<VehicleMaintenanceApply[]>([])
|
||||
const vehicleOptions = ref<Vehicle[]>([])
|
||||
@@ -366,6 +384,7 @@ const formRules = {
|
||||
const viewVisible = ref(false)
|
||||
const viewLoading = ref(false)
|
||||
const viewDetail = ref<VehicleMaintenanceApply | null>(null)
|
||||
const viewingRecord = ref<VehicleMaintenanceApply | null>(null)
|
||||
|
||||
const viewSections = computed<ViewSection[]>(() => {
|
||||
const d = viewDetail.value
|
||||
@@ -417,8 +436,8 @@ async function loadUserOptions() {
|
||||
}
|
||||
|
||||
async function loadVehicleOptions() {
|
||||
const res = await vehicleApi.list()
|
||||
vehicleOptions.value = (res.data ?? res) || []
|
||||
const res = await vehicleApi.list({ page: 1, pageSize: 100 })
|
||||
vehicleOptions.value = pickBxList(res)
|
||||
}
|
||||
|
||||
async function showMaintenanceReminders(licensePlate: string) {
|
||||
@@ -537,6 +556,7 @@ async function handleEdit(row: VehicleMaintenanceApply) {
|
||||
}
|
||||
|
||||
async function handleView(row: VehicleMaintenanceApply) {
|
||||
viewingRecord.value = row
|
||||
viewVisible.value = true
|
||||
viewLoading.value = true
|
||||
try {
|
||||
@@ -547,6 +567,28 @@ async function handleView(row: VehicleMaintenanceApply) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条申请')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarCancel() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条申请')
|
||||
return
|
||||
}
|
||||
handleCancel(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleViewCancel() {
|
||||
if (!viewingRecord.value) return
|
||||
await handleCancel(viewingRecord.value)
|
||||
viewVisible.value = false
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
await formRef.value?.validate()
|
||||
if (attachmentUploadRef.value?.hasUploading?.()) {
|
||||
@@ -593,18 +635,6 @@ async function handleCancel(row: VehicleMaintenanceApply) {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete(row: VehicleMaintenanceApply) {
|
||||
await ElMessageBox.confirm('确定删除该申请吗?', '提示', { type: 'warning' })
|
||||
deleteLoadingMap[row.id] = true
|
||||
try {
|
||||
await vehicleMaintenanceApplyApi.delete(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
fetchData()
|
||||
} finally {
|
||||
deleteLoadingMap[row.id] = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([loadVehicleOptions(), loadUserOptions()])
|
||||
fetchData()
|
||||
|
||||
@@ -75,16 +75,53 @@
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">共 <span class="sel-num">{{ pagination.total }}</span> 条申请</div>
|
||||
<el-button @click="handleSupplement">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="!canToolbarProcess"
|
||||
@click="handleToolbarProcess"
|
||||
>
|
||||
<el-icon><Tools /></el-icon>处理
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :disabled="!canToolbarEdit" @click="handleToolbarEdit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canToolbarRevoke"
|
||||
:loading="toolbarRevokeLoading"
|
||||
@click="handleToolbarRevoke"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>撤销处理
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleSupplement">
|
||||
<el-icon><Plus /></el-icon>无申请补录
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="tableData" v-loading="loading" stripe row-key="applyId">
|
||||
<el-table-column prop="applyNo" label="申请单号" min-width="170" show-overflow-tooltip fixed="left" />
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="tableData"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="applyId"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column prop="applyNo" label="申请单号" min-width="170" show-overflow-tooltip fixed="left">
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.applyNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applyDate" label="申请日期" min-width="120" align="center" />
|
||||
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" />
|
||||
<el-table-column prop="applyStatus" label="申请状态" min-width="100" align="center">
|
||||
@@ -120,31 +157,6 @@
|
||||
<el-table-column prop="handlerName" label="处理人" min-width="100" align="center">
|
||||
<template #default="{ row }">{{ row.handlerName || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="260" fixed="right" align="center" class-name="col-actions">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="row.applyStatus === 'pending'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleProcess(row)"
|
||||
>
|
||||
<el-icon><Tools /></el-icon>处理
|
||||
</el-button>
|
||||
<template v-if="row.applyStatus === 'processed' && row.processId">
|
||||
<el-button link type="primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
:loading="deleteLoadingMap[row.processId]"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>撤销处理
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -269,10 +281,46 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewVisible"
|
||||
:title="viewRow?.applyNo || '维保处理详情'"
|
||||
:sections="viewSections"
|
||||
width="760px"
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
>
|
||||
<template v-if="viewRow" #hero-actions>
|
||||
<div class="maintenance-process-view-hero-actions">
|
||||
<el-button
|
||||
v-if="viewRow.applyStatus === 'pending'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleViewProcess"
|
||||
>
|
||||
<el-icon><Tools /></el-icon>处理
|
||||
</el-button>
|
||||
<template v-if="viewRow.applyStatus === 'processed' && viewRow.processId">
|
||||
<el-button class="btn-main" type="primary" @click="handleViewEdit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:loading="deleteLoadingMap[viewRow.processId]"
|
||||
@click="handleViewRevoke"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>撤销处理
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { Check, Close, Delete, Edit, Plus, RefreshLeft, Search, Tools } from '@element-plus/icons-vue'
|
||||
import { fetchUserOptions } from '@/api/admin'
|
||||
import {
|
||||
@@ -282,7 +330,9 @@ import {
|
||||
type Vehicle,
|
||||
type VehicleMaintenanceProcessBoardItem
|
||||
} from '@/api/pl'
|
||||
import { pickBxList } from '@/utils/http/bx'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import SystemViewDialog, { type ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import {
|
||||
getPlMaintenanceApplyStatusLabel,
|
||||
@@ -308,6 +358,7 @@ const userOptions = ref<
|
||||
const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const deleteLoadingMap = reactive<Record<string, boolean>>({})
|
||||
const selectedRows = ref<VehicleMaintenanceProcessBoardItem[]>([])
|
||||
const tableData = ref<VehicleMaintenanceProcessBoardItem[]>([])
|
||||
const vehicleOptions = ref<Vehicle[]>([])
|
||||
const applyDateRange = ref<string[]>([])
|
||||
@@ -353,6 +404,79 @@ const formRules = computed(() => ({
|
||||
processDate: [{ required: true, message: '请选择处理日期', trigger: 'change' }]
|
||||
}))
|
||||
|
||||
const viewVisible = ref(false)
|
||||
const viewRow = ref<VehicleMaintenanceProcessBoardItem | null>(null)
|
||||
|
||||
const selectedRow = computed(() =>
|
||||
selectedRows.value.length === 1 ? selectedRows.value[0] : null
|
||||
)
|
||||
|
||||
const canToolbarProcess = computed(
|
||||
() => selectedRow.value?.applyStatus === 'pending'
|
||||
)
|
||||
|
||||
const canToolbarEdit = computed(
|
||||
() =>
|
||||
selectedRow.value?.applyStatus === 'processed' && Boolean(selectedRow.value?.processId)
|
||||
)
|
||||
|
||||
const canToolbarRevoke = computed(
|
||||
() =>
|
||||
selectedRow.value?.applyStatus === 'processed' && Boolean(selectedRow.value?.processId)
|
||||
)
|
||||
|
||||
const toolbarRevokeLoading = computed(() => {
|
||||
const id = selectedRow.value?.processId
|
||||
return id ? Boolean(deleteLoadingMap[id]) : false
|
||||
})
|
||||
|
||||
const viewSections = computed<ViewSection[]>(() => {
|
||||
const row = viewRow.value
|
||||
if (!row) return []
|
||||
const sections: ViewSection[] = [
|
||||
{
|
||||
title: '申请信息',
|
||||
fields: [
|
||||
{ label: '申请单号', value: row.applyNo },
|
||||
{ label: '申请日期', value: row.applyDate },
|
||||
{
|
||||
label: '申请状态',
|
||||
value: getPlMaintenanceApplyStatusLabel(row.applyStatus),
|
||||
tagType: getPlMaintenanceApplyStatusTagType(row.applyStatus)
|
||||
},
|
||||
{ label: '车牌号', value: row.licensePlate },
|
||||
{
|
||||
label: '维保类型',
|
||||
value: getPlMaintenanceTypeLabel(row.maintenanceType),
|
||||
tagType: getPlMaintenanceTypeTagType(row.maintenanceType)
|
||||
},
|
||||
{ label: '申请人', value: row.applicantName || '—' },
|
||||
{ label: '开始日期', value: row.startDate },
|
||||
{ label: '预计取车', value: row.expectedPickupDate || '—' },
|
||||
{ label: '维保内容', value: row.maintenanceContent || '—', span: 2 },
|
||||
{ label: '维修店地址', value: row.shopAddress || '—', span: 2 },
|
||||
{ label: '申请备注', value: row.applyRemark || '—', span: 2 }
|
||||
]
|
||||
}
|
||||
]
|
||||
if (row.processId) {
|
||||
sections.push({
|
||||
title: '处理信息',
|
||||
fields: [
|
||||
{ label: '处理单号', value: row.processNo || '—' },
|
||||
{ label: '处理日期', value: row.processDate || '—' },
|
||||
{
|
||||
label: '金额',
|
||||
value: row.amount != null ? `${Number(row.amount).toFixed(2)} 元` : '—'
|
||||
},
|
||||
{ label: '处理人', value: row.handlerName || '—' },
|
||||
{ label: '处理备注', value: row.processRemark || '—', span: 2 }
|
||||
]
|
||||
})
|
||||
}
|
||||
return sections
|
||||
})
|
||||
|
||||
async function loadUserOptions() {
|
||||
try {
|
||||
const res = await fetchUserOptions()
|
||||
@@ -372,8 +496,8 @@ async function loadUserOptions() {
|
||||
}
|
||||
|
||||
async function loadVehicleOptions() {
|
||||
const res = await vehicleApi.list()
|
||||
vehicleOptions.value = (res.data ?? res) || []
|
||||
const res = await vehicleApi.list({ page: 1, pageSize: 100 })
|
||||
vehicleOptions.value = pickBxList(res)
|
||||
}
|
||||
|
||||
async function showMaintenanceReminders(licensePlate: string) {
|
||||
@@ -500,6 +624,49 @@ async function handleEdit(row: VehicleMaintenanceProcessBoardItem) {
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: VehicleMaintenanceProcessBoardItem[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function handleView(row: VehicleMaintenanceProcessBoardItem) {
|
||||
viewRow.value = row
|
||||
viewVisible.value = true
|
||||
}
|
||||
|
||||
function handleToolbarProcess() {
|
||||
if (!selectedRow.value || !canToolbarProcess.value) return
|
||||
handleProcess(selectedRow.value)
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (!selectedRow.value || !canToolbarEdit.value) return
|
||||
handleEdit(selectedRow.value)
|
||||
}
|
||||
|
||||
function handleToolbarRevoke() {
|
||||
if (!selectedRow.value || !canToolbarRevoke.value) return
|
||||
handleDelete(selectedRow.value)
|
||||
}
|
||||
|
||||
function handleViewProcess() {
|
||||
if (!viewRow.value) return
|
||||
viewVisible.value = false
|
||||
handleProcess(viewRow.value)
|
||||
}
|
||||
|
||||
function handleViewEdit() {
|
||||
if (!viewRow.value) return
|
||||
viewVisible.value = false
|
||||
handleEdit(viewRow.value)
|
||||
}
|
||||
|
||||
function handleViewRevoke() {
|
||||
if (!viewRow.value) return
|
||||
handleDelete(viewRow.value).then(() => {
|
||||
viewVisible.value = false
|
||||
})
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
await formRef.value?.validate()
|
||||
if (attachmentUploadRef.value?.hasUploading?.()) {
|
||||
@@ -583,4 +750,10 @@ onMounted(() => {
|
||||
.apply-summary-span-2 {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.maintenance-process-view-hero-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -58,6 +58,24 @@
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增申请
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1 || selectedRows[0].status !== 'pending'"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="warning"
|
||||
:disabled="selectedRows.length !== 1 || selectedRows[0].status !== 'pending'"
|
||||
:loading="selectedRows.length === 1 && cancelLoadingMap[selectedRows[0].id]"
|
||||
@click="handleToolbarCancel"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -69,9 +87,14 @@
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column prop="applyNo" label="申请单号" min-width="170" show-overflow-tooltip />
|
||||
<el-table-column prop="applyNo" label="申请单号" min-width="170" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.applyNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="licensePlate" label="车牌号" min-width="120" align="center" />
|
||||
<el-table-column prop="rechargeType" label="充值类型" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
@@ -93,24 +116,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center" />
|
||||
<el-table-column label="操作" min-width="280" fixed="right" align="center" class-name="col-actions">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<template v-if="row.status === 'pending'">
|
||||
<el-button link type="primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button link type="warning" :loading="cancelLoadingMap[row.id]" @click="handleCancel(row)">
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
<el-button link type="danger" :loading="deleteLoadingMap[row.id]" @click="handleDelete(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -213,21 +218,34 @@
|
||||
width="720px"
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
/>
|
||||
>
|
||||
<template v-if="viewingRecord?.status === 'pending'" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRecord!)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="warning"
|
||||
:loading="cancelLoadingMap[viewingRecord!.id]"
|
||||
@click="handleViewCancel"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import {
|
||||
Check,
|
||||
CircleClose,
|
||||
Close,
|
||||
Delete,
|
||||
Edit,
|
||||
Plus,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
View
|
||||
Search
|
||||
} from '@element-plus/icons-vue'
|
||||
import {
|
||||
vehicleApi,
|
||||
@@ -235,6 +253,7 @@ import {
|
||||
type Vehicle,
|
||||
type VehicleRechargeApply
|
||||
} from '@/api/pl'
|
||||
import { pickBxList } from '@/utils/http/bx'
|
||||
import { fetchUserOptions } from '@/api/admin'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import SystemViewDialog, { type ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
@@ -260,7 +279,6 @@ const userOptions = ref<
|
||||
const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const cancelLoadingMap = reactive<Record<string, boolean>>({})
|
||||
const deleteLoadingMap = reactive<Record<string, boolean>>({})
|
||||
const tableData = ref<VehicleRechargeApply[]>([])
|
||||
const selectedRows = ref<VehicleRechargeApply[]>([])
|
||||
const vehicleOptions = ref<Vehicle[]>([])
|
||||
@@ -306,6 +324,7 @@ const formRules = {
|
||||
const viewVisible = ref(false)
|
||||
const viewLoading = ref(false)
|
||||
const viewDetail = ref<VehicleRechargeApply | null>(null)
|
||||
const viewingRecord = ref<VehicleRechargeApply | null>(null)
|
||||
|
||||
const viewSections = computed<ViewSection[]>(() => {
|
||||
const d = viewDetail.value
|
||||
@@ -354,8 +373,8 @@ async function loadUserOptions() {
|
||||
}
|
||||
|
||||
async function loadVehicleOptions() {
|
||||
const res = await vehicleApi.list()
|
||||
vehicleOptions.value = (res.data ?? res) || []
|
||||
const res = await vehicleApi.list({ page: 1, pageSize: 100 })
|
||||
vehicleOptions.value = pickBxList(res)
|
||||
}
|
||||
|
||||
async function fetchData() {
|
||||
@@ -436,6 +455,7 @@ async function handleEdit(row: VehicleRechargeApply) {
|
||||
}
|
||||
|
||||
async function handleView(row: VehicleRechargeApply) {
|
||||
viewingRecord.value = row
|
||||
viewVisible.value = true
|
||||
viewLoading.value = true
|
||||
try {
|
||||
@@ -446,6 +466,28 @@ async function handleView(row: VehicleRechargeApply) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条申请')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarCancel() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条申请')
|
||||
return
|
||||
}
|
||||
handleCancel(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleViewCancel() {
|
||||
if (!viewingRecord.value) return
|
||||
await handleCancel(viewingRecord.value)
|
||||
viewVisible.value = false
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
await formRef.value?.validate()
|
||||
if (attachmentUploadRef.value?.hasUploading?.()) {
|
||||
@@ -489,18 +531,6 @@ async function handleCancel(row: VehicleRechargeApply) {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete(row: VehicleRechargeApply) {
|
||||
await ElMessageBox.confirm('确定删除该申请吗?', '提示', { type: 'warning' })
|
||||
deleteLoadingMap[row.id] = true
|
||||
try {
|
||||
await vehicleRechargeApplyApi.delete(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
fetchData()
|
||||
} finally {
|
||||
deleteLoadingMap[row.id] = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([loadVehicleOptions(), loadUserOptions()])
|
||||
fetchData()
|
||||
|
||||
@@ -63,16 +63,68 @@
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">共 <span class="sel-num">{{ pagination.total }}</span> 条申请</div>
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button @click="handleSupplement">
|
||||
<el-icon><Plus /></el-icon>无申请补录
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1 || selectedRows[0].applyStatus !== 'pending'"
|
||||
@click="handleToolbarDisburse"
|
||||
>
|
||||
<el-icon><Money /></el-icon>发放
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="
|
||||
selectedRows.length !== 1 ||
|
||||
selectedRows[0].applyStatus !== 'disbursed' ||
|
||||
!selectedRows[0].recordId
|
||||
"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="
|
||||
selectedRows.length !== 1 ||
|
||||
selectedRows[0].applyStatus !== 'disbursed' ||
|
||||
!selectedRows[0].recordId
|
||||
"
|
||||
:loading="
|
||||
selectedRows.length === 1 &&
|
||||
selectedRows[0].recordId &&
|
||||
deleteLoadingMap[selectedRows[0].recordId]
|
||||
"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>撤销发放
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="tableData" v-loading="loading" stripe row-key="applyId">
|
||||
<el-table-column prop="applyNo" label="申请单号" min-width="170" show-overflow-tooltip fixed="left" />
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="tableData"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="applyId"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column prop="applyNo" label="申请单号" min-width="170" show-overflow-tooltip fixed="left">
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.applyNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applyDate" label="申请日期" min-width="120" align="center" />
|
||||
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" />
|
||||
<el-table-column prop="odometerKm" label="期初公里数" min-width="110" align="right">
|
||||
@@ -115,34 +167,6 @@
|
||||
<el-table-column prop="recordCreateByName" label="登记人" min-width="100" align="center">
|
||||
<template #default="{ row }">{{ row.recordCreateByName || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="300" fixed="right" align="center" class-name="col-actions">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.applyStatus === 'pending'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleDisburse(row)"
|
||||
>
|
||||
<el-icon><Money /></el-icon>发放
|
||||
</el-button>
|
||||
<template v-if="row.applyStatus === 'disbursed' && row.recordId">
|
||||
<el-button link type="primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
:loading="deleteLoadingMap[row.recordId]"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>撤销发放
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -270,23 +294,49 @@
|
||||
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewVisible"
|
||||
:title="viewRow?.applyNo || '发放详情'"
|
||||
:title="viewingRecord?.applyNo || '发放详情'"
|
||||
:sections="viewSections"
|
||||
width="760px"
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
/>
|
||||
>
|
||||
<template v-if="viewingRecord" #hero-actions>
|
||||
<el-button
|
||||
v-if="viewingRecord.applyStatus === 'pending'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleDisburse(viewingRecord)"
|
||||
>
|
||||
<el-icon><Money /></el-icon>发放
|
||||
</el-button>
|
||||
<template v-if="viewingRecord.applyStatus === 'disbursed' && viewingRecord.recordId">
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRecord)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:loading="deleteLoadingMap[viewingRecord.recordId]"
|
||||
@click="handleViewDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>撤销发放
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close, Delete, Edit, Money, Plus, RefreshLeft, Search, View } from '@element-plus/icons-vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { Check, Close, Delete, Edit, Money, Plus, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import {
|
||||
vehicleApi,
|
||||
vehicleRechargeRecordApi,
|
||||
type Vehicle,
|
||||
type VehicleRechargeDisburseBoardItem
|
||||
} from '@/api/pl'
|
||||
import { pickBxList } from '@/utils/http/bx'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import SystemViewDialog, { type ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
@@ -307,6 +357,7 @@ const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const deleteLoadingMap = reactive<Record<string, boolean>>({})
|
||||
const tableData = ref<VehicleRechargeDisburseBoardItem[]>([])
|
||||
const selectedRows = ref<VehicleRechargeDisburseBoardItem[]>([])
|
||||
const vehicleOptions = ref<Vehicle[]>([])
|
||||
const applyDateRange = ref<string[]>([])
|
||||
const rechargeDateRange = ref<string[]>([])
|
||||
@@ -358,10 +409,10 @@ const formRules = computed(() => ({
|
||||
}))
|
||||
|
||||
const viewVisible = ref(false)
|
||||
const viewRow = ref<VehicleRechargeDisburseBoardItem | null>(null)
|
||||
const viewingRecord = ref<VehicleRechargeDisburseBoardItem | null>(null)
|
||||
|
||||
const viewSections = computed<ViewSection[]>(() => {
|
||||
const row = viewRow.value
|
||||
const row = viewingRecord.value
|
||||
if (!row) return []
|
||||
const sections: ViewSection[] = [
|
||||
{
|
||||
@@ -410,8 +461,8 @@ const viewSections = computed<ViewSection[]>(() => {
|
||||
})
|
||||
|
||||
async function loadVehicleOptions() {
|
||||
const vehicles = await vehicleApi.list()
|
||||
vehicleOptions.value = (vehicles.data ?? vehicles) || []
|
||||
const vehicles = await vehicleApi.list({ page: 1, pageSize: 100 })
|
||||
vehicleOptions.value = pickBxList(vehicles)
|
||||
}
|
||||
|
||||
async function fetchData() {
|
||||
@@ -450,6 +501,10 @@ function handleReset() {
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: VehicleRechargeDisburseBoardItem[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
formData.id = ''
|
||||
formData.rechargeOrderNo = ''
|
||||
@@ -511,10 +566,40 @@ async function handleEdit(row: VehicleRechargeDisburseBoardItem) {
|
||||
}
|
||||
|
||||
function handleView(row: VehicleRechargeDisburseBoardItem) {
|
||||
viewRow.value = row
|
||||
viewingRecord.value = row
|
||||
viewVisible.value = true
|
||||
}
|
||||
|
||||
function handleToolbarDisburse() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条申请')
|
||||
return
|
||||
}
|
||||
handleDisburse(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条申请')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条申请')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleViewDelete() {
|
||||
if (!viewingRecord.value) return
|
||||
await handleDelete(viewingRecord.value)
|
||||
viewVisible.value = false
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
await formRef.value?.validate()
|
||||
if (attachmentUploadRef.value?.hasUploading?.()) {
|
||||
|
||||
@@ -52,6 +52,24 @@
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增申请
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1 || selectedRows[0].status !== 'pending'"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="warning"
|
||||
:disabled="selectedRows.length !== 1 || selectedRows[0].status !== 'pending'"
|
||||
:loading="selectedRows.length === 1 && cancelLoadingMap[selectedRows[0].id]"
|
||||
@click="handleToolbarCancel"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -63,9 +81,14 @@
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column prop="applyNo" label="申请单号" min-width="170" show-overflow-tooltip />
|
||||
<el-table-column prop="applyNo" label="申请单号" min-width="170" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.applyNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="licensePlate" label="车牌号" min-width="120" align="center" />
|
||||
<el-table-column prop="applyDate" label="申请时间" min-width="120" align="center" />
|
||||
<el-table-column prop="warehouseInDate" label="入库时间" min-width="120" align="center" />
|
||||
@@ -85,24 +108,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center" />
|
||||
<el-table-column label="操作" min-width="280" fixed="right" align="center" class-name="col-actions">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<template v-if="row.status === 'pending'">
|
||||
<el-button link type="primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button link type="warning" :loading="cancelLoadingMap[row.id]" @click="handleCancel(row)">
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
<el-button link type="danger" :loading="deleteLoadingMap[row.id]" @click="handleDelete(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -217,21 +222,34 @@
|
||||
width="720px"
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
/>
|
||||
>
|
||||
<template v-if="viewingRecord?.status === 'pending'" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRecord!)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="warning"
|
||||
:loading="cancelLoadingMap[viewingRecord!.id]"
|
||||
@click="handleViewCancel"
|
||||
>
|
||||
<el-icon><CircleClose /></el-icon>作废
|
||||
</el-button>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import {
|
||||
Check,
|
||||
CircleClose,
|
||||
Close,
|
||||
Delete,
|
||||
Edit,
|
||||
Plus,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
View
|
||||
Search
|
||||
} from '@element-plus/icons-vue'
|
||||
import {
|
||||
vehicleApi,
|
||||
@@ -239,6 +257,7 @@ import {
|
||||
type Vehicle,
|
||||
type VehicleUreaApply
|
||||
} from '@/api/pl'
|
||||
import { pickBxList } from '@/utils/http/bx'
|
||||
import { fetchUserOptions } from '@/api/admin'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import SystemViewDialog, { type ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
@@ -263,7 +282,6 @@ const userOptions = ref<
|
||||
const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const cancelLoadingMap = reactive<Record<string, boolean>>({})
|
||||
const deleteLoadingMap = reactive<Record<string, boolean>>({})
|
||||
const tableData = ref<VehicleUreaApply[]>([])
|
||||
const selectedRows = ref<VehicleUreaApply[]>([])
|
||||
const vehicleOptions = ref<Vehicle[]>([])
|
||||
@@ -313,6 +331,7 @@ const formRules = {
|
||||
const viewVisible = ref(false)
|
||||
const viewLoading = ref(false)
|
||||
const viewDetail = ref<VehicleUreaApply | null>(null)
|
||||
const viewingRecord = ref<VehicleUreaApply | null>(null)
|
||||
|
||||
const viewSections = computed<ViewSection[]>(() => {
|
||||
const d = viewDetail.value
|
||||
@@ -359,8 +378,8 @@ async function loadUserOptions() {
|
||||
}
|
||||
|
||||
async function loadVehicleOptions() {
|
||||
const res = await vehicleApi.list()
|
||||
vehicleOptions.value = (res.data ?? res) || []
|
||||
const res = await vehicleApi.list({ page: 1, pageSize: 100 })
|
||||
vehicleOptions.value = pickBxList(res)
|
||||
}
|
||||
|
||||
async function fetchData() {
|
||||
@@ -445,6 +464,7 @@ async function handleEdit(row: VehicleUreaApply) {
|
||||
}
|
||||
|
||||
async function handleView(row: VehicleUreaApply) {
|
||||
viewingRecord.value = row
|
||||
viewVisible.value = true
|
||||
viewLoading.value = true
|
||||
try {
|
||||
@@ -455,6 +475,28 @@ async function handleView(row: VehicleUreaApply) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条申请')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarCancel() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请先勾选一条申请')
|
||||
return
|
||||
}
|
||||
handleCancel(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleViewCancel() {
|
||||
if (!viewingRecord.value) return
|
||||
await handleCancel(viewingRecord.value)
|
||||
viewVisible.value = false
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
await formRef.value?.validate()
|
||||
if (formData.applyDate && formData.warehouseInDate && formData.applyDate > formData.warehouseInDate) {
|
||||
@@ -504,18 +546,6 @@ async function handleCancel(row: VehicleUreaApply) {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete(row: VehicleUreaApply) {
|
||||
await ElMessageBox.confirm('确定删除该申请吗?', '提示', { type: 'warning' })
|
||||
deleteLoadingMap[row.id] = true
|
||||
try {
|
||||
await vehicleUreaApplyApi.delete(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
fetchData()
|
||||
} finally {
|
||||
deleteLoadingMap[row.id] = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([loadVehicleOptions(), loadUserOptions()])
|
||||
fetchData()
|
||||
|
||||
@@ -57,16 +57,53 @@
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">共 <span class="sel-num">{{ pagination.total }}</span> 条申请</div>
|
||||
<el-button @click="handleSupplement">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="!canToolbarDisburse"
|
||||
@click="handleToolbarDisburse"
|
||||
>
|
||||
<el-icon><Money /></el-icon>发放
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :disabled="!canToolbarEdit" @click="handleToolbarEdit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canToolbarRevoke"
|
||||
:loading="toolbarRevokeLoading"
|
||||
@click="handleToolbarRevoke"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>撤销发放
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleSupplement">
|
||||
<el-icon><Plus /></el-icon>无申请补录
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="fetchData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="tableData" v-loading="loading" stripe row-key="applyId">
|
||||
<el-table-column prop="applyNo" label="申请单号" min-width="170" show-overflow-tooltip fixed="left" />
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="tableData"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="applyId"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" />
|
||||
<el-table-column prop="applyNo" label="申请单号" min-width="170" show-overflow-tooltip fixed="left">
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.applyNo }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="applyDate" label="申请时间" min-width="120" align="center" />
|
||||
<el-table-column prop="warehouseInDate" label="入库时间" min-width="120" align="center" />
|
||||
<el-table-column prop="applicantName" label="申请人" min-width="100" align="center" />
|
||||
@@ -99,34 +136,6 @@
|
||||
<el-table-column prop="handlerName" label="处理人" min-width="100" align="center">
|
||||
<template #default="{ row }">{{ row.handlerName || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="300" fixed="right" align="center" class-name="col-actions">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.applyStatus === 'pending'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleDisburse(row)"
|
||||
>
|
||||
<el-icon><Money /></el-icon>发放
|
||||
</el-button>
|
||||
<template v-if="row.applyStatus === 'disbursed' && row.disburseId">
|
||||
<el-button link type="primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
:loading="deleteLoadingMap[row.disburseId]"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>撤销发放
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -245,18 +254,46 @@
|
||||
width="760px"
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
/>
|
||||
>
|
||||
<template v-if="viewRow" #hero-actions>
|
||||
<div class="urea-disburse-view-hero-actions">
|
||||
<el-button
|
||||
v-if="viewRow.applyStatus === 'pending'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleViewDisburse"
|
||||
>
|
||||
<el-icon><Money /></el-icon>发放
|
||||
</el-button>
|
||||
<template v-if="viewRow.applyStatus === 'disbursed' && viewRow.disburseId">
|
||||
<el-button class="btn-main" type="primary" @click="handleViewEdit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:loading="deleteLoadingMap[viewRow.disburseId]"
|
||||
@click="handleViewRevoke"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>撤销发放
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close, Delete, Edit, Money, Plus, RefreshLeft, Search, View } from '@element-plus/icons-vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { Check, Close, Delete, Edit, Money, Plus, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import {
|
||||
vehicleApi,
|
||||
vehicleUreaDisburseApi,
|
||||
type Vehicle,
|
||||
type VehicleUreaDisburseBoardItem
|
||||
} from '@/api/pl'
|
||||
import { pickBxList } from '@/utils/http/bx'
|
||||
import { fetchUserOptions } from '@/api/admin'
|
||||
import AttachmentUploadField from '@/components/business/attachment-upload-field/index.vue'
|
||||
import SystemViewDialog, { type ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
@@ -279,6 +316,7 @@ const userOptions = ref<
|
||||
const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
const deleteLoadingMap = reactive<Record<string, boolean>>({})
|
||||
const selectedRows = ref<VehicleUreaDisburseBoardItem[]>([])
|
||||
const tableData = ref<VehicleUreaDisburseBoardItem[]>([])
|
||||
const vehicleOptions = ref<Vehicle[]>([])
|
||||
const applyDateRange = ref<string[]>([])
|
||||
@@ -327,6 +365,29 @@ const formRules = computed(() => ({
|
||||
const viewVisible = ref(false)
|
||||
const viewRow = ref<VehicleUreaDisburseBoardItem | null>(null)
|
||||
|
||||
const selectedRow = computed(() =>
|
||||
selectedRows.value.length === 1 ? selectedRows.value[0] : null
|
||||
)
|
||||
|
||||
const canToolbarDisburse = computed(
|
||||
() => selectedRow.value?.applyStatus === 'pending'
|
||||
)
|
||||
|
||||
const canToolbarEdit = computed(
|
||||
() =>
|
||||
selectedRow.value?.applyStatus === 'disbursed' && Boolean(selectedRow.value?.disburseId)
|
||||
)
|
||||
|
||||
const canToolbarRevoke = computed(
|
||||
() =>
|
||||
selectedRow.value?.applyStatus === 'disbursed' && Boolean(selectedRow.value?.disburseId)
|
||||
)
|
||||
|
||||
const toolbarRevokeLoading = computed(() => {
|
||||
const id = selectedRow.value?.disburseId
|
||||
return id ? Boolean(deleteLoadingMap[id]) : false
|
||||
})
|
||||
|
||||
const viewSections = computed<ViewSection[]>(() => {
|
||||
const row = viewRow.value
|
||||
if (!row) return []
|
||||
@@ -388,8 +449,8 @@ async function loadUserOptions() {
|
||||
}
|
||||
|
||||
async function loadVehicleOptions() {
|
||||
const vehicles = await vehicleApi.list()
|
||||
vehicleOptions.value = (vehicles.data ?? vehicles) || []
|
||||
const vehicles = await vehicleApi.list({ page: 1, pageSize: 100 })
|
||||
vehicleOptions.value = pickBxList(vehicles)
|
||||
}
|
||||
|
||||
async function fetchData() {
|
||||
@@ -486,11 +547,49 @@ async function handleEdit(row: VehicleUreaDisburseBoardItem) {
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: VehicleUreaDisburseBoardItem[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function handleView(row: VehicleUreaDisburseBoardItem) {
|
||||
viewRow.value = row
|
||||
viewVisible.value = true
|
||||
}
|
||||
|
||||
function handleToolbarDisburse() {
|
||||
if (!selectedRow.value || !canToolbarDisburse.value) return
|
||||
handleDisburse(selectedRow.value)
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (!selectedRow.value || !canToolbarEdit.value) return
|
||||
handleEdit(selectedRow.value)
|
||||
}
|
||||
|
||||
function handleToolbarRevoke() {
|
||||
if (!selectedRow.value || !canToolbarRevoke.value) return
|
||||
handleDelete(selectedRow.value)
|
||||
}
|
||||
|
||||
function handleViewDisburse() {
|
||||
if (!viewRow.value) return
|
||||
viewVisible.value = false
|
||||
handleDisburse(viewRow.value)
|
||||
}
|
||||
|
||||
function handleViewEdit() {
|
||||
if (!viewRow.value) return
|
||||
viewVisible.value = false
|
||||
handleEdit(viewRow.value)
|
||||
}
|
||||
|
||||
function handleViewRevoke() {
|
||||
if (!viewRow.value) return
|
||||
handleDelete(viewRow.value).then(() => {
|
||||
viewVisible.value = false
|
||||
})
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
await formRef.value?.validate()
|
||||
if (attachmentUploadRef.value?.hasUploading?.()) {
|
||||
@@ -570,4 +669,10 @@ onMounted(() => {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
}
|
||||
|
||||
.urea-disburse-view-hero-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -64,73 +64,126 @@
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增车辆
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="fetchData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 卡片列表 -->
|
||||
<div class="list-body list-wrap vehicle-card-wrap" v-loading="loading">
|
||||
<p v-if="!vehicleList.length && !loading" class="vehicle-card-empty">暂无车辆</p>
|
||||
|
||||
<div v-else class="vehicle-card-grid">
|
||||
<article
|
||||
v-for="row in vehicleList"
|
||||
:key="row.id"
|
||||
class="vehicle-card"
|
||||
:class="{ 'is-selected': isSelected(row) }"
|
||||
@dblclick="handleView(row)"
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="vehicleList"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
prop="licensePlate"
|
||||
label="车牌号"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<div class="vehicle-card-head">
|
||||
<el-checkbox
|
||||
:model-value="isSelected(row)"
|
||||
@change="(checked: boolean) => toggleSelect(row, checked)"
|
||||
@click.stop
|
||||
/>
|
||||
<div class="vehicle-card-title">
|
||||
<span class="vehicle-card-name">{{ row.licensePlate }}</span>
|
||||
<el-tag :type="getVehicleTypeTagType(row.vehicleType)" size="small">
|
||||
{{ getVehicleTypeLabel(row.vehicleType) }}
|
||||
</el-tag>
|
||||
<el-tag :type="getStatusTagType(row.vehicleStatus)" size="small">
|
||||
{{ getStatusLabel(row.vehicleStatus) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.licensePlate }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="车辆类型" min-width="100" align="center" header-align="center" v-if="isColumnVisible('vehicleType')">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getVehicleTypeTagType(row.vehicleType)" size="small">
|
||||
{{ getVehicleTypeLabel(row.vehicleType) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="车辆状态" min-width="100" align="center" header-align="center" v-if="isColumnVisible('vehicleStatus')">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="getStatusTagType(row.vehicleStatus)" size="small">
|
||||
{{ getStatusLabel(row.vehicleStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('trailerNo')"
|
||||
prop="trailerNo"
|
||||
label="挂车号"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('loadCapacity')"
|
||||
prop="loadCapacity"
|
||||
label="载重(吨)"
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('carrierName')"
|
||||
prop="carrierName"
|
||||
label="承运商"
|
||||
min-width="140"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('personnelSummary')"
|
||||
prop="personnelSummary"
|
||||
label="关联人员"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('remark')"
|
||||
prop="remark"
|
||||
label="备注"
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
</el-table>
|
||||
|
||||
<dl class="vehicle-card-kv">
|
||||
<div class="vehicle-card-kv-item">
|
||||
<dt>挂车号</dt>
|
||||
<dd>{{ row.trailerNo || '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-card-kv-item">
|
||||
<dt>载重(吨)</dt>
|
||||
<dd>{{ row.loadCapacity || '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-card-kv-item">
|
||||
<dt>承运商</dt>
|
||||
<dd>{{ row.carrierName || '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-card-kv-item">
|
||||
<dt>关联人员</dt>
|
||||
<dd>{{ row.personnelSummary || '—' }}</dd>
|
||||
</div>
|
||||
<div class="vehicle-card-kv-item">
|
||||
<dt>备注</dt>
|
||||
<dd>{{ row.remark || '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div class="vehicle-card-actions">
|
||||
<el-button link type="primary" @click.stop="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button link type="primary" @click.stop="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" :disabled="!canDeleteByCreator(row)" :title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP" @click.stop="handleDelete(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</div>
|
||||
</article>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -293,6 +346,20 @@
|
||||
modal-class="order-module-dialog-mask"
|
||||
append-to-body
|
||||
>
|
||||
<template v-if="viewDetail" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEditFromView">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewDetail)"
|
||||
:title="canDeleteByCreator(viewDetail) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDeleteFromView"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-button>
|
||||
</template>
|
||||
<template #vehicleDetailTabs>
|
||||
<PlVehicleCertPersonnelTabs
|
||||
:cert-list="viewDetail?.certList || []"
|
||||
@@ -306,7 +373,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Check, Close, Delete, Edit, Plus, RefreshLeft, Search, Van, View } from '@element-plus/icons-vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { Check, Close, Delete, Edit, Plus, RefreshLeft, Search, Van } from '@element-plus/icons-vue'
|
||||
import {
|
||||
vehicleApi,
|
||||
carrierApi,
|
||||
@@ -325,6 +394,8 @@ import SystemViewDialog, {
|
||||
type ViewSection
|
||||
} from '@/components/business/system-view-dialog/index.vue'
|
||||
import { useDbInstantSearch } from '@/composables/useDbInstantSearch'
|
||||
import { pickBxList, pickBxPageResult } from '@/utils/http/bx'
|
||||
import { DEFAULT_LIST_PAGE_SIZE } from '@/utils/table/tableConfig'
|
||||
import { formatDateTime } from '@/utils/format'
|
||||
import {
|
||||
PL_VEHICLE_CERT_NAME_OPTIONS,
|
||||
@@ -341,6 +412,25 @@ const submitLoading = ref(false)
|
||||
const dialogLoading = ref(false)
|
||||
const vehicleList = ref<Vehicle[]>([])
|
||||
const carrierList = ref<Carrier[]>([])
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'vehicleType', label: '车辆类型' },
|
||||
{ prop: 'vehicleStatus', label: '车辆状态' },
|
||||
{ prop: 'trailerNo', label: '挂车号' },
|
||||
{ prop: 'loadCapacity', label: '载重(吨)' },
|
||||
{ prop: 'carrierName', label: '承运商' },
|
||||
{ prop: 'personnelSummary', label: '关联人员' },
|
||||
{ prop: 'remark', label: '备注', defaultVisible: false }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('pl-vehicle-list-columns', listColumnDefs)
|
||||
|
||||
const personnelOptions = ref<Personnel[]>([])
|
||||
const selectedRows = ref<Vehicle[]>([])
|
||||
const dialogVisible = ref(false)
|
||||
@@ -365,6 +455,12 @@ const searchForm = reactive({
|
||||
vehicleStatus: ''
|
||||
})
|
||||
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
pageSize: DEFAULT_LIST_PAGE_SIZE,
|
||||
total: 0
|
||||
})
|
||||
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
licensePlate: '',
|
||||
@@ -550,8 +646,13 @@ function resolvePersonnelRows(rows: VehiclePersonnelRow[]) {
|
||||
}
|
||||
|
||||
async function loadPersonnelOptions() {
|
||||
const res = await personnelApi.list({ status: '1' })
|
||||
personnelOptions.value = (res.data ?? res) || []
|
||||
const res = await personnelApi.list({ status: '1', pageSize: 100 })
|
||||
personnelOptions.value = pickBxList<Personnel>(res)
|
||||
}
|
||||
|
||||
async function loadCarrierOptions() {
|
||||
const res = await carrierApi.list({ page: 1, pageSize: 100 })
|
||||
carrierList.value = pickBxList<Carrier>(res)
|
||||
}
|
||||
|
||||
function handleAddPersonnel() {
|
||||
@@ -616,17 +717,17 @@ function validateSubTables(): boolean {
|
||||
async function fetchData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const [vehicleRes, carrierRes] = await Promise.all([
|
||||
vehicleApi.list({
|
||||
q: searchForm.q || undefined,
|
||||
vehicleType: searchForm.vehicleType || undefined,
|
||||
carrierId: searchForm.carrierId || undefined,
|
||||
vehicleStatus: searchForm.vehicleStatus || undefined
|
||||
}),
|
||||
carrierApi.list()
|
||||
])
|
||||
vehicleList.value = (vehicleRes.data ?? vehicleRes) || []
|
||||
carrierList.value = (carrierRes.data ?? carrierRes) || []
|
||||
const res = await vehicleApi.list({
|
||||
q: searchForm.q || undefined,
|
||||
vehicleType: searchForm.vehicleType || undefined,
|
||||
carrierId: searchForm.carrierId || undefined,
|
||||
vehicleStatus: searchForm.vehicleStatus || undefined,
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
const { list, total } = pickBxPageResult<Vehicle>(res)
|
||||
vehicleList.value = list
|
||||
pagination.total = total
|
||||
const idSet = new Set(vehicleList.value.map(item => item.id))
|
||||
selectedRows.value = selectedRows.value.filter(item => idSet.has(item.id))
|
||||
} finally {
|
||||
@@ -635,6 +736,7 @@ async function fetchData() {
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
@@ -644,21 +746,48 @@ function handleReset() {
|
||||
searchForm.carrierId = ''
|
||||
searchForm.vehicleStatus = ''
|
||||
selectedRows.value = []
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function isSelected(row: Vehicle) {
|
||||
return selectedRows.value.some(item => item.id === row.id)
|
||||
function handlePageChange() {
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function toggleSelect(row: Vehicle, checked: boolean) {
|
||||
if (checked) {
|
||||
if (!isSelected(row)) {
|
||||
selectedRows.value = [...selectedRows.value, row]
|
||||
}
|
||||
function handleSizeChange() {
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: Vehicle[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条车辆记录')
|
||||
return
|
||||
}
|
||||
selectedRows.value = selectedRows.value.filter(item => item.id !== row.id)
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条车辆记录')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleEditFromView() {
|
||||
if (!viewDetail.value) return
|
||||
viewVisible.value = false
|
||||
handleEdit(viewDetail.value)
|
||||
}
|
||||
|
||||
async function handleDeleteFromView() {
|
||||
if (!viewDetail.value) return
|
||||
await handleDelete(viewDetail.value)
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
@@ -812,6 +941,10 @@ async function handleDelete(row: Vehicle) {
|
||||
await ElMessageBox.confirm('确定删除该车辆吗?', '提示', { type: 'warning' })
|
||||
await vehicleApi.delete(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
if (viewDetail.value?.id === row.id) {
|
||||
viewVisible.value = false
|
||||
viewDetail.value = null
|
||||
}
|
||||
fetchData()
|
||||
}
|
||||
|
||||
@@ -826,126 +959,12 @@ useDbInstantSearch(
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
loadCarrierOptions()
|
||||
fetchData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.vehicle-card-wrap {
|
||||
min-height: 120px;
|
||||
padding: 16px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.vehicle-card-empty {
|
||||
margin: 0;
|
||||
padding: 24px 0;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.vehicle-card-grid {
|
||||
display: grid;
|
||||
width: 100%;
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
|
||||
gap: 16px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.vehicle-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
height: 100%;
|
||||
min-height: 240px;
|
||||
padding: 16px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
||||
transition:
|
||||
border-color 0.2s ease,
|
||||
box-shadow 0.2s ease,
|
||||
background-color 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: #a7f3d0;
|
||||
box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
|
||||
}
|
||||
|
||||
&.is-selected {
|
||||
border-color: #10b981;
|
||||
background: #ecfdf5;
|
||||
}
|
||||
}
|
||||
|
||||
.vehicle-card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.vehicle-card-title {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.vehicle-card-name {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.vehicle-card-kv {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 10px;
|
||||
margin: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.vehicle-card-kv-item {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
font-size: 13px;
|
||||
|
||||
dt {
|
||||
margin: 0;
|
||||
color: #1e293b;
|
||||
font-weight: 500;
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
color: #1e293b;
|
||||
word-break: break-word;
|
||||
line-height: 1.5;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.vehicle-card-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 4px 8px;
|
||||
padding-top: 12px;
|
||||
margin-top: auto;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.sub-table-section {
|
||||
margin-top: 16px;
|
||||
grid-column: 1 / -1;
|
||||
@@ -967,15 +986,4 @@ onMounted(() => {
|
||||
.sub-table {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.vehicle-card-wrap {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.vehicle-card-grid {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>组织管理</h2>
|
||||
<h2 class="title-bar-heading">组织管理</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -17,10 +17,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按组织名称模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -37,9 +37,37 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarAddChild"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增子组织
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="toggleExpand">
|
||||
{{ isExpandAll ? '全部折叠' : '全部展开' }}
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -63,7 +91,11 @@
|
||||
min-width="140"
|
||||
align="left"
|
||||
header-align="left"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.deptName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="deptCategoryCode"
|
||||
label="组织类别"
|
||||
@@ -102,39 +134,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="160"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button class="btn-op-item primary" @click="handleAddChild(row)">
|
||||
新增子组织
|
||||
</el-button>
|
||||
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="view">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="edit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -249,12 +248,34 @@
|
||||
:icon="OfficeBuilding"
|
||||
:meta="`${viewRow?.leader ? '负责人:' + viewRow.leader : ''}${viewRow?.leader && viewRow?.createTime ? ' · ' : ''}${viewRow?.createTime || ''}`"
|
||||
:sections="viewSections"
|
||||
/>
|
||||
>
|
||||
<template v-if="viewRow" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewRow)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleAddChild(viewRow)">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增子组织
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewRow)"
|
||||
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(viewRow)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ref, reactive, computed, onMounted, nextTick } from 'vue'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@@ -262,10 +283,8 @@
|
||||
Plus,
|
||||
Close,
|
||||
Check,
|
||||
View,
|
||||
Edit,
|
||||
Delete,
|
||||
More,
|
||||
OfficeBuilding,
|
||||
RefreshLeft,
|
||||
Search
|
||||
@@ -689,26 +708,35 @@ const dictStore = useDictStore()
|
||||
}
|
||||
}
|
||||
|
||||
function handleDropdownCommand(command: string, row: any) {
|
||||
switch (command) {
|
||||
case 'view':
|
||||
handleView(row)
|
||||
break
|
||||
case 'edit':
|
||||
handleEdit(row)
|
||||
break
|
||||
case 'delete':
|
||||
handleDelete(row)
|
||||
break
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条组织')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Dept.DeptItem)
|
||||
function handleToolbarAddChild() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条组织')
|
||||
return
|
||||
}
|
||||
handleAddChild(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条组织')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Dept.DeptItem) {
|
||||
if (!canDeleteByCreator(row)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
{
|
||||
try {
|
||||
const childCount = row.children?.length || 0
|
||||
const confirmText = childCount
|
||||
@@ -718,6 +746,10 @@ const dictStore = useDictStore()
|
||||
await ElMessageBox.confirm(confirmText, '提示', { type: 'warning' })
|
||||
await fetchDeleteDept(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
if (viewRow.value?.id === row.id) {
|
||||
viewVisible.value = false
|
||||
viewRow.value = null
|
||||
}
|
||||
await Promise.all([loadData(), loadDeptTreeForSelect()])
|
||||
} catch (error: any) {
|
||||
if (error !== 'cancel') console.error('删除失败:', error)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>字典类型</h2>
|
||||
<h2 class="title-bar-heading">字典类型</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -16,10 +16,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按字典名称、类型编码模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -36,6 +36,32 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarDictData"
|
||||
>
|
||||
<el-icon><Setting /></el-icon>
|
||||
字典数据配置
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
@@ -43,8 +69,11 @@
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
批量删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -73,7 +102,11 @@
|
||||
min-width="150"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.dictName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="dictType"
|
||||
label="字典类型编码"
|
||||
@@ -95,39 +128,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="130"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button class="btn-op-item primary" @click="handleDictData(row)">
|
||||
字典数据配置
|
||||
</el-button>
|
||||
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="view">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="edit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
@@ -192,6 +192,26 @@
|
||||
:meta="`字典类型编码:${viewRow?.dictType || ''}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
|
||||
:sections="viewSections"
|
||||
>
|
||||
<template v-if="viewRow" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleDictData(viewRow)">
|
||||
<el-icon><Setting /></el-icon>
|
||||
字典数据配置
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleEdit(viewRow)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewRow)"
|
||||
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(viewRow)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
<template #append>
|
||||
<div class="view-section dict-view-data-section">
|
||||
<h3>字典数据</h3>
|
||||
@@ -272,10 +292,37 @@
|
||||
</div>
|
||||
<div class="list-toolbar dict-data-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ dictDataSelectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button class="btn-main" type="primary" @click="handleAddDictData">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增数据
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="dictDataSelectedRows.length !== 1"
|
||||
@click="handleToolbarEditDictData"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="
|
||||
dictDataSelectedRows.length !== 1 || !canDeleteByCreator(dictDataSelectedRows[0])
|
||||
"
|
||||
:title="
|
||||
dictDataSelectedRows.length === 1 && !canDeleteByCreator(dictDataSelectedRows[0])
|
||||
? CREATOR_DELETE_TIP
|
||||
: ''
|
||||
"
|
||||
@click="handleToolbarDeleteDictData"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-body list-wrap dict-data-table-wrap">
|
||||
@@ -285,7 +332,9 @@
|
||||
v-loading="dictDataLoading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleDictDataSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
@@ -336,27 +385,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="260"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item primary" @click="handleEditDictData(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-op-item"
|
||||
:disabled="!canDeleteByCreator(row)"
|
||||
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDeleteDictData(row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
@@ -456,6 +484,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@@ -463,10 +492,9 @@
|
||||
Plus,
|
||||
Close,
|
||||
Check,
|
||||
View,
|
||||
Edit,
|
||||
Delete,
|
||||
More,
|
||||
Setting,
|
||||
Collection,
|
||||
RefreshLeft,
|
||||
Search
|
||||
@@ -490,7 +518,7 @@
|
||||
const tableData = ref<Api.Dict.DictTypeItem[]>([])
|
||||
const selectedRows = ref<Api.Dict.DictTypeItem[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('新增字典类型')
|
||||
const isEdit = ref(false)
|
||||
@@ -630,30 +658,63 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleDropdownCommand(command: string, row: Api.Dict.DictTypeItem) {
|
||||
switch (command) {
|
||||
case 'view':
|
||||
handleView(row)
|
||||
break
|
||||
case 'edit':
|
||||
handleEdit(row)
|
||||
break
|
||||
case 'delete':
|
||||
handleDelete(row)
|
||||
break
|
||||
function handleToolbarDictData() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条字典类型')
|
||||
return
|
||||
}
|
||||
handleDictData(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Dict.DictTypeItem)
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条字典类型')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条字典类型')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleDictDataSelectionChange(rows: Api.Dict.DictDataItem[]) {
|
||||
dictDataSelectedRows.value = rows
|
||||
}
|
||||
|
||||
function handleToolbarEditDictData() {
|
||||
if (dictDataSelectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条字典数据')
|
||||
return
|
||||
}
|
||||
handleEditDictData(dictDataSelectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDeleteDictData() {
|
||||
if (dictDataSelectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条字典数据')
|
||||
return
|
||||
}
|
||||
handleDeleteDictData(dictDataSelectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Dict.DictTypeItem) {
|
||||
if (!canDeleteByCreator(row)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
{
|
||||
await ElMessageBox.confirm(`确定删除字典类型「${row.dictName}」吗?`, '提示', {
|
||||
type: 'warning'
|
||||
})
|
||||
await fetchDeleteDictType(row.id)
|
||||
if (viewRow.value?.id === row.id) {
|
||||
viewVisible.value = false
|
||||
viewRow.value = null
|
||||
}
|
||||
await loadData()
|
||||
}
|
||||
|
||||
@@ -687,8 +748,9 @@
|
||||
|
||||
const dictDataDialogVisible = ref(false)
|
||||
const dictDataTableData = ref<Api.Dict.DictDataItem[]>([])
|
||||
const dictDataSelectedRows = ref<Api.Dict.DictDataItem[]>([])
|
||||
const dictDataLoading = ref(false)
|
||||
const dictDataPagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const dictDataPagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
const currentDictType = reactive({ dictName: '', dictType: '' })
|
||||
const dictDataFormVisible = ref(false)
|
||||
const dictDataFormTitle = ref('新增字典数据')
|
||||
@@ -729,6 +791,7 @@
|
||||
currentDictType.dictName = row.dictName
|
||||
currentDictType.dictType = row.dictType
|
||||
dictDataPagination.page = 1
|
||||
dictDataSelectedRows.value = []
|
||||
dictDataDialogVisible.value = true
|
||||
loadDictData()
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>请假列表</h2>
|
||||
<h2 class="title-bar-heading">请假列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -29,10 +29,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按原因、类型模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -45,7 +45,38 @@
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">新增请假</el-button>
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增请假
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="!toolbarCanEdit"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="!toolbarCanSubmit"
|
||||
@click="handleToolbarSubmit"
|
||||
>
|
||||
<el-icon><Promotion /></el-icon>
|
||||
提交审批
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!toolbarCanDelete"
|
||||
:title="toolbarDeleteTitle"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -57,6 +88,7 @@
|
||||
row-key="id"
|
||||
v-loading="loading"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
@@ -65,7 +97,11 @@
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.leaveTypeLabel || '--' }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="startDate"
|
||||
label="开始日期"
|
||||
@@ -108,38 +144,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
fixed="right"
|
||||
min-width="260"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<template v-if="row.status === 'draft' || row.status === 'rejected'">
|
||||
<el-button type="primary" link size="small" @click="handleEdit(row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button type="success" link size="small" @click="handleSubmit(row.id)"
|
||||
>提交审批</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="canDeleteByCreator(row)"
|
||||
type="danger"
|
||||
link
|
||||
size="small"
|
||||
@click="handleDelete(row)"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
<template v-else-if="row.status === 'pending'">
|
||||
<el-tag type="warning" size="small">审批中</el-tag>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span style="color: #1e293b; font-size: 12px">已结束</span>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -236,13 +240,45 @@
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewVisible"
|
||||
:title="viewingRecord?.leaveTypeLabel || '请假详情'"
|
||||
:icon="Document"
|
||||
:sections="leaveViewSections"
|
||||
>
|
||||
<template v-if="viewingRecord && canEditLeave(viewingRecord)" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRecord)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleSubmit(viewingRecord.id)">
|
||||
<el-icon><Promotion /></el-icon>
|
||||
提交审批
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canDeleteByCreator(viewingRecord)"
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
@click="handleDelete(viewingRecord)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Close, Check, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { Close, Check, RefreshLeft, Search, Plus, Edit, Delete, Promotion, Document } from '@element-plus/icons-vue'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import SystemViewDialog, {
|
||||
type ViewField,
|
||||
type ViewSection
|
||||
} from '@/components/business/system-view-dialog/index.vue'
|
||||
import {
|
||||
fetchLeaveList,
|
||||
fetchCreateLeave,
|
||||
@@ -258,7 +294,7 @@
|
||||
const loading = ref(false)
|
||||
const tableData = ref<Api.Leave.LeaveItem[]>([])
|
||||
const selectedRows = ref<Api.Leave.LeaveItem[]>([])
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
const filterForm = reactive({ keyword: '', status: '' })
|
||||
|
||||
@@ -267,6 +303,54 @@
|
||||
const editingId = ref('')
|
||||
const submitting = ref(false)
|
||||
|
||||
const viewVisible = ref(false)
|
||||
const viewingRecord = ref<Api.Leave.LeaveItem | null>(null)
|
||||
|
||||
const leaveViewSections = computed<ViewSection[]>(() => {
|
||||
const row = viewingRecord.value
|
||||
if (!row) return []
|
||||
const fields: ViewField[] = [
|
||||
{ label: '请假类型', value: row.leaveTypeLabel || '--' },
|
||||
{ label: '状态', value: dictStore.getLabel('leave_status', row.status), tagType: dictStore.getTagType('leave_status', row.status) },
|
||||
{ label: '开始日期', value: row.startDate || '--' },
|
||||
{ label: '结束日期', value: row.endDate || '--' },
|
||||
{ label: '天数', value: row.days != null ? String(row.days) : '--' },
|
||||
{ label: '创建时间', value: row.createTime || '--' },
|
||||
{ label: '请假原因', value: row.reason || '--', colSpan: 2 },
|
||||
{ label: '备注', value: row.remark || '--', colSpan: 2 }
|
||||
]
|
||||
return [{ title: '基本信息', fields }]
|
||||
})
|
||||
|
||||
const toolbarSelectedRow = computed(() =>
|
||||
selectedRows.value.length === 1 ? selectedRows.value[0] : null
|
||||
)
|
||||
|
||||
const toolbarCanEdit = computed(
|
||||
() => !!toolbarSelectedRow.value && canEditLeave(toolbarSelectedRow.value)
|
||||
)
|
||||
|
||||
const toolbarCanSubmit = computed(
|
||||
() => !!toolbarSelectedRow.value && canEditLeave(toolbarSelectedRow.value)
|
||||
)
|
||||
|
||||
const toolbarCanDelete = computed(() => {
|
||||
const row = toolbarSelectedRow.value
|
||||
return !!row && canEditLeave(row) && canDeleteByCreator(row)
|
||||
})
|
||||
|
||||
const toolbarDeleteTitle = computed(() => {
|
||||
const row = toolbarSelectedRow.value
|
||||
if (!row) return ''
|
||||
if (!canEditLeave(row)) return '仅草稿或已驳回状态可删除'
|
||||
if (!canDeleteByCreator(row)) return CREATOR_DELETE_TIP
|
||||
return ''
|
||||
})
|
||||
|
||||
function canEditLeave(row: Api.Leave.LeaveItem) {
|
||||
return row.status === 'draft' || row.status === 'rejected'
|
||||
}
|
||||
|
||||
const formData = reactive({
|
||||
leaveType: 'personal',
|
||||
startDate: '',
|
||||
@@ -326,6 +410,35 @@
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
function handleView(row: Api.Leave.LeaveItem) {
|
||||
viewingRecord.value = row
|
||||
viewVisible.value = true
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (!toolbarSelectedRow.value) {
|
||||
ElMessage.warning('请选择一条请假记录')
|
||||
return
|
||||
}
|
||||
handleEdit(toolbarSelectedRow.value)
|
||||
}
|
||||
|
||||
function handleToolbarSubmit() {
|
||||
if (!toolbarSelectedRow.value) {
|
||||
ElMessage.warning('请选择一条请假记录')
|
||||
return
|
||||
}
|
||||
handleSubmit(toolbarSelectedRow.value.id)
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (!toolbarSelectedRow.value) {
|
||||
ElMessage.warning('请选择一条请假记录')
|
||||
return
|
||||
}
|
||||
handleDelete(toolbarSelectedRow.value)
|
||||
}
|
||||
|
||||
function handleEdit(row: Api.Leave.LeaveItem) {
|
||||
isEdit.value = true
|
||||
editingId.value = row.id
|
||||
@@ -365,13 +478,17 @@
|
||||
type: 'warning'
|
||||
})
|
||||
await fetchSubmitLeave(id)
|
||||
if (viewingRecord.value?.id === id) {
|
||||
viewVisible.value = false
|
||||
viewingRecord.value = null
|
||||
}
|
||||
loadData()
|
||||
} catch {
|
||||
// cancelled or error
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete(row: { id: string }) {
|
||||
async function handleDelete(row: Api.Leave.LeaveItem) {
|
||||
if (!canDeleteByCreator(row)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
@@ -379,6 +496,10 @@
|
||||
try {
|
||||
await ElMessageBox.confirm('确定删除此请假申请?', '提示', { type: 'warning' })
|
||||
await fetchDeleteLeave(row.id)
|
||||
if (viewingRecord.value?.id === row.id) {
|
||||
viewVisible.value = false
|
||||
viewingRecord.value = null
|
||||
}
|
||||
loadData()
|
||||
} catch {
|
||||
// cancelled or error
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>菜单列表</h2>
|
||||
<h2 class="title-bar-heading">菜单列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -16,10 +16,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按菜单名称模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -36,9 +36,37 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarAddChild"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增子菜单
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="toggleExpand">
|
||||
{{ isExpandAll ? '全部折叠' : '全部展开' }}
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -64,7 +92,11 @@
|
||||
header-align="left"
|
||||
class-name="col-menu-name"
|
||||
label-class-name="col-menu-name"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.menuName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="menuType"
|
||||
label="类型"
|
||||
@@ -137,39 +169,6 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="160"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button class="btn-op-item primary" @click="handleAddChild(row)">
|
||||
新增子菜单
|
||||
</el-button>
|
||||
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="view">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="edit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -260,12 +259,34 @@
|
||||
:icon="MenuIcon"
|
||||
:meta="`类型:${dictStore.getLabel('menu_type', viewRow?.menuType || '')}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
|
||||
:sections="viewSections"
|
||||
/>
|
||||
>
|
||||
<template v-if="viewRow" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewRow)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleAddChild(viewRow)">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增子菜单
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewRow)"
|
||||
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(viewRow)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ref, reactive, computed, onMounted, nextTick } from 'vue'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@@ -273,10 +294,8 @@
|
||||
Plus,
|
||||
Close,
|
||||
Check,
|
||||
View,
|
||||
Edit,
|
||||
Delete,
|
||||
More,
|
||||
Menu as MenuIcon,
|
||||
RefreshLeft,
|
||||
Search
|
||||
@@ -523,26 +542,35 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleDropdownCommand(command: string, row: any) {
|
||||
switch (command) {
|
||||
case 'view':
|
||||
handleView(row)
|
||||
break
|
||||
case 'edit':
|
||||
handleEdit(row)
|
||||
break
|
||||
case 'delete':
|
||||
handleDelete(row)
|
||||
break
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条菜单')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Menu.MenuItem)
|
||||
function handleToolbarAddChild() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条菜单')
|
||||
return
|
||||
}
|
||||
handleAddChild(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条菜单')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Menu.MenuItem) {
|
||||
if (!canDeleteByCreator(row)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
{
|
||||
try {
|
||||
const childCount = row.children?.length || 0
|
||||
const confirmText = childCount
|
||||
@@ -552,6 +580,10 @@
|
||||
await ElMessageBox.confirm(confirmText, '提示', { type: 'warning' })
|
||||
await fetchDeleteMenu(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
if (viewRow.value?.id === row.id) {
|
||||
viewVisible.value = false
|
||||
viewRow.value = null
|
||||
}
|
||||
await loadData()
|
||||
} catch (error: any) {
|
||||
if (error !== 'cancel') console.error('删除失败:', error)
|
||||
|
||||
@@ -46,8 +46,36 @@
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarView"
|
||||
>
|
||||
<el-icon><View /></el-icon>
|
||||
查看详情
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table class="list-table" :data="tableData" stripe v-loading="loading" row-key="id">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="tableData"
|
||||
stripe
|
||||
v-loading="loading"
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="openDetail"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
@@ -69,7 +97,11 @@
|
||||
label="操作摘要"
|
||||
min-width="180"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openDetail(row)">{{ row.operSummary || '—' }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="operName" label="操作人员" min-width="120" align="center" />
|
||||
<el-table-column prop="operTime" label="操作时间" min-width="170" align="center" />
|
||||
<el-table-column label="状态" min-width="90" align="center" header-align="center">
|
||||
@@ -80,19 +112,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="costTime" label="耗时(ms)" min-width="100" align="center" />
|
||||
<el-table-column
|
||||
label="操作"
|
||||
fixed="right"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link size="small" @click="openDetail(row)">
|
||||
<el-icon><View /></el-icon>详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination list-pager-bar">
|
||||
@@ -118,6 +137,24 @@
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div v-if="detailRow" class="operlog-detail-body">
|
||||
<div class="operlog-view-hero">
|
||||
<div class="operlog-view-hero-main">
|
||||
<h2>{{ detailRow.title || '操作日志详情' }}</h2>
|
||||
<div class="operlog-view-hero-tags">
|
||||
<el-tag :type="getOperLogBusinessTypeTagType(detailRow.businessType)" size="small">
|
||||
{{ getOperLogBusinessTypeLabel(detailRow.businessType) }}
|
||||
</el-tag>
|
||||
<el-tag :type="detailRow.status === 0 ? 'success' : 'danger'" size="small">
|
||||
{{ detailRow.status === 0 ? '成功' : '失败' }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<p class="operlog-view-hero-meta">
|
||||
操作人员:{{ detailRow.operName || '—' }}
|
||||
<span class="dot">·</span>
|
||||
{{ detailRow.operTime || '—' }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-kv-grid">
|
||||
<div class="detail-kv-item"><span class="label">操作模块</span><span>{{ detailRow.title }}</span></div>
|
||||
<div class="detail-kv-item">
|
||||
@@ -156,6 +193,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { Close, RefreshLeft, Search, View } from '@element-plus/icons-vue'
|
||||
import { list as listOperLog, detail as getOperLogDetail } from '@/api/monitor/operlog'
|
||||
import type { OperLogVO, OperLogQuery } from '@/api/monitor/operlog/types'
|
||||
@@ -167,7 +205,8 @@ import {
|
||||
|
||||
const loading = ref(false)
|
||||
const tableData = ref<OperLogVO[]>([])
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const selectedRows = ref<OperLogVO[]>([])
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
const searchForm = reactive({
|
||||
title: '',
|
||||
businessType: undefined as number | undefined,
|
||||
@@ -178,6 +217,18 @@ const searchForm = reactive({
|
||||
const detailVisible = ref(false)
|
||||
const detailRow = ref<OperLogVO | null>(null)
|
||||
|
||||
function handleSelectionChange(rows: OperLogVO[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
function handleToolbarView() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条操作日志')
|
||||
return
|
||||
}
|
||||
openDetail(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function buildQuery(): OperLogQuery {
|
||||
return {
|
||||
pageNum: pagination.page,
|
||||
@@ -234,6 +285,41 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.operlog-view-hero {
|
||||
margin: -4px 0 16px;
|
||||
padding: 16px 18px;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 55%);
|
||||
border: 1px solid #d9e8e2;
|
||||
}
|
||||
|
||||
.operlog-view-hero-main {
|
||||
h2 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #1e293b;
|
||||
}
|
||||
}
|
||||
|
||||
.operlog-view-hero-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.operlog-view-hero-meta {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
line-height: 1.5;
|
||||
|
||||
.dot {
|
||||
margin: 0 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-kv-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>职位列表</h2>
|
||||
<h2 class="title-bar-heading">职位列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -17,10 +17,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按职位名称、编码模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -37,6 +37,32 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增职位
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarBindUsers"
|
||||
>
|
||||
<el-icon><User /></el-icon>
|
||||
关联用户
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
@@ -44,8 +70,11 @@
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
批量删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -74,7 +103,11 @@
|
||||
min-width="140"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.postName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="postCode"
|
||||
label="职位编码"
|
||||
@@ -102,40 +135,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="160"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button class="btn-op-item primary" @click="handlePostBindUsers(row)">
|
||||
<el-icon><User /></el-icon>
|
||||
关联用户
|
||||
</el-button>
|
||||
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="view">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="edit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
@@ -311,12 +310,34 @@
|
||||
:icon="Briefcase"
|
||||
:meta="`职位编码:${viewRow?.postCode || ''}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
|
||||
:sections="viewSections"
|
||||
/>
|
||||
>
|
||||
<template v-if="viewRow" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewRow)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handlePostBindUsers(viewRow)">
|
||||
<el-icon><User /></el-icon>
|
||||
关联用户
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewRow)"
|
||||
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(viewRow)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ref, reactive, computed, onMounted, nextTick } from 'vue'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@@ -325,10 +346,8 @@
|
||||
Close,
|
||||
Check,
|
||||
User,
|
||||
View,
|
||||
Edit,
|
||||
Delete,
|
||||
More,
|
||||
Briefcase,
|
||||
RefreshLeft,
|
||||
Search
|
||||
@@ -358,7 +377,7 @@ const dictStore = useDictStore()
|
||||
const tableData = ref<Api.Post.PostItem[]>([])
|
||||
const selectedRows = ref<Api.Post.PostItem[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('新增职位')
|
||||
const isEdit = ref(false)
|
||||
@@ -696,29 +715,42 @@ const dictStore = useDictStore()
|
||||
}
|
||||
}
|
||||
|
||||
function handleDropdownCommand(command: string, row: any) {
|
||||
switch (command) {
|
||||
case 'view':
|
||||
handleView(row)
|
||||
break
|
||||
case 'edit':
|
||||
handleEdit(row)
|
||||
break
|
||||
case 'delete':
|
||||
handleDelete(row)
|
||||
break
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条职位')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Post.PostItem)
|
||||
function handleToolbarBindUsers() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条职位')
|
||||
return
|
||||
}
|
||||
handlePostBindUsers(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条职位')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Post.PostItem) {
|
||||
if (!canDeleteByCreator(row)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
{
|
||||
await ElMessageBox.confirm(`确定删除职位「${row.postName}」吗?`, '提示', { type: 'warning' })
|
||||
await fetchDeletePost(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
if (viewRow.value?.id === row.id) {
|
||||
viewVisible.value = false
|
||||
viewRow.value = null
|
||||
}
|
||||
await loadData()
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>角色列表</h2>
|
||||
<h2 class="title-bar-heading">角色列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -17,10 +17,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按角色名称模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -37,6 +37,40 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增角色
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarMenuConfig"
|
||||
>
|
||||
<el-icon><Menu /></el-icon>
|
||||
菜单配置
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarDataScope"
|
||||
>
|
||||
<el-icon><DataAnalysis /></el-icon>
|
||||
数据权限
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
@@ -44,8 +78,11 @@
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
批量删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -74,7 +111,11 @@
|
||||
min-width="140"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.roleName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="dataScope"
|
||||
label="数据权限"
|
||||
@@ -106,42 +147,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="200"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button class="btn-op-item primary" @click="handleMenuConfig(row)"
|
||||
>菜单配置</el-button
|
||||
>
|
||||
<el-button class="btn-op-item primary" @click="handleDataScope(row)"
|
||||
><el-icon><DataAnalysis /></el-icon>数据权限</el-button
|
||||
>
|
||||
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="view">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="edit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
@@ -379,6 +384,30 @@
|
||||
:meta="`数据权限:${dataScopeLabel(viewDataScopeCode || viewRow?.dataScope || '')}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
|
||||
:sections="viewSections"
|
||||
>
|
||||
<template v-if="viewRow" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleMenuConfig(viewRow)">
|
||||
<el-icon><Menu /></el-icon>
|
||||
菜单配置
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleDataScope(viewRow)">
|
||||
<el-icon><DataAnalysis /></el-icon>
|
||||
数据权限
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleEdit(viewRow)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewRow)"
|
||||
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(viewRow)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
<template #menuTree>
|
||||
<div class="role-view-tree-block" v-loading="viewDetailLoading">
|
||||
<div v-if="viewMenuTreeData.length" class="role-view-tree-scroll">
|
||||
@@ -422,6 +451,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ref, reactive, computed, onMounted, nextTick, watch } from 'vue'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@@ -430,11 +460,10 @@
|
||||
Close,
|
||||
Check,
|
||||
DataAnalysis,
|
||||
View,
|
||||
Stamp,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
More,
|
||||
Menu,
|
||||
Edit,
|
||||
Delete
|
||||
} from '@element-plus/icons-vue'
|
||||
@@ -472,7 +501,7 @@ const dictStore = useDictStore()
|
||||
const tableData = ref<Api.Role.RoleItem[]>([])
|
||||
const selectedRows = ref<Api.Role.RoleItem[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
// ---- 新增/编辑弹窗 ----
|
||||
const dialogVisible = ref(false)
|
||||
@@ -741,28 +770,49 @@ const dictStore = useDictStore()
|
||||
}
|
||||
}
|
||||
|
||||
function handleDropdownCommand(command: string, row: any) {
|
||||
switch (command) {
|
||||
case 'view':
|
||||
handleView(row)
|
||||
break
|
||||
case 'edit':
|
||||
handleEdit(row)
|
||||
break
|
||||
case 'delete':
|
||||
handleDelete(row)
|
||||
break
|
||||
function handleToolbarMenuConfig() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条角色')
|
||||
return
|
||||
}
|
||||
handleMenuConfig(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Role.RoleItem)
|
||||
function handleToolbarDataScope() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条角色')
|
||||
return
|
||||
}
|
||||
handleDataScope(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条角色')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条角色')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Role.RoleItem) {
|
||||
if (!canDeleteByCreator(row)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
{
|
||||
await ElMessageBox.confirm(`确定删除角色「${row.roleName}」吗?`, '提示', { type: 'warning' })
|
||||
await fetchDeleteRole(row.id)
|
||||
if (viewRow.value?.id === row.id) {
|
||||
viewVisible.value = false
|
||||
viewRow.value = null
|
||||
}
|
||||
await loadData()
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>站点列表</h2>
|
||||
<h2 class="title-bar-heading">站点列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -17,10 +17,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按站点名称、编码模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -44,8 +44,11 @@
|
||||
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
批量删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -74,7 +77,11 @@
|
||||
min-width="140"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.siteName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="siteCode"
|
||||
label="站点编码"
|
||||
@@ -144,9 +151,6 @@
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button class="btn-op-item" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
@@ -299,10 +303,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ref, reactive, computed, onMounted, nextTick } from 'vue'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Plus, Close, Check, View, Edit, Delete, More, Location, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { Plus, Close, Check, Edit, Delete, More, Location, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
|
||||
import { useDictStore } from '@/store/modules/dict'
|
||||
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
|
||||
@@ -373,7 +378,7 @@ const dictStore = useDictStore()
|
||||
const tableData = ref<Api.Site.SiteItem[]>([])
|
||||
const selectedRows = ref<Api.Site.SiteItem[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('新增站点')
|
||||
const isEdit = ref(false)
|
||||
@@ -650,12 +655,11 @@ const dictStore = useDictStore()
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Site.SiteItem)
|
||||
async function handleDelete(row: Api.Site.SiteItem) {
|
||||
if (!canDeleteByCreator(row)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
{
|
||||
await ElMessageBox.confirm(`确定删除站点「${row.siteName}」吗?`, '提示', { type: 'warning' })
|
||||
await fetchDeleteSite(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>租户列表</h2>
|
||||
<h2 class="title-bar-heading">租户列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -17,10 +17,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按租户编号、名称模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -37,6 +37,34 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增租户
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="
|
||||
selectedRows.length !== 1 ||
|
||||
isDefaultTenantRow(selectedRows[0]) ||
|
||||
!canDeleteByCreator(selectedRows[0])
|
||||
"
|
||||
:title="
|
||||
selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0])
|
||||
? CREATOR_DELETE_TIP
|
||||
: selectedRows.length === 1 && isDefaultTenantRow(selectedRows[0])
|
||||
? '默认租户不可删除'
|
||||
: ''
|
||||
"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
@@ -44,8 +72,11 @@
|
||||
:title="allRowsDeletableByCreator(deletableSelection) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
批量删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -99,7 +130,11 @@
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.tenantName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="contactName"
|
||||
label="联系人"
|
||||
@@ -121,36 +156,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="120"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button class="btn-op-item" @click="handleView(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="edit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="delete" divided :disabled="isDefaultTenantRow(row) || !canDeleteByCreator(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
@@ -223,12 +228,36 @@
|
||||
:icon="OfficeBuilding"
|
||||
:meta="viewRow?.createTime || ''"
|
||||
:sections="viewSections"
|
||||
/>
|
||||
>
|
||||
<template v-if="viewRow" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewRow)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="isDefaultTenantRow(viewRow) || !canDeleteByCreator(viewRow)"
|
||||
:title="
|
||||
isDefaultTenantRow(viewRow)
|
||||
? '默认租户不可删除'
|
||||
: canDeleteByCreator(viewRow)
|
||||
? ''
|
||||
: CREATOR_DELETE_TIP
|
||||
"
|
||||
@click="handleDelete(viewRow)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@@ -236,10 +265,8 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
|
||||
Plus,
|
||||
Close,
|
||||
Check,
|
||||
View,
|
||||
Edit,
|
||||
Delete,
|
||||
More,
|
||||
OfficeBuilding,
|
||||
RefreshLeft,
|
||||
Search
|
||||
@@ -262,7 +289,7 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
|
||||
const tableData = ref<Api.Tenant.TenantItem[]>([])
|
||||
const selectedRows = ref<Api.Tenant.TenantItem[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('新增租户')
|
||||
const isEdit = ref(false)
|
||||
@@ -414,15 +441,20 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
|
||||
viewVisible.value = true
|
||||
}
|
||||
|
||||
function handleDropdownCommand(command: string, row: any) {
|
||||
switch (command) {
|
||||
case 'edit':
|
||||
handleEdit(row)
|
||||
break
|
||||
case 'delete':
|
||||
handleDelete(row)
|
||||
break
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条租户')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条租户')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Tenant.TenantItem) {
|
||||
@@ -436,6 +468,10 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
|
||||
}
|
||||
await ElMessageBox.confirm(`确定删除租户「${row.tenantName}」吗?`, '提示', { type: 'warning' })
|
||||
await fetchDeleteTenant(row.id)
|
||||
if (viewRow.value?.id === row.id) {
|
||||
viewVisible.value = false
|
||||
viewRow.value = null
|
||||
}
|
||||
await loadData()
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="w-[280px] shrink-0 border-r border-[var(--mint-border)] pr-4">
|
||||
<!-- 标题与搜索同处 panel-top:避免标题栏底边与独立输入框之间出现不可控的视觉断层 -->
|
||||
<div class="panel-top user-dept-aside__head">
|
||||
<h2>组织</h2>
|
||||
<h2 class="title-bar-heading">组织</h2>
|
||||
<el-input v-model="deptKeyword" placeholder="搜索组织" clearable />
|
||||
</div>
|
||||
<el-tree
|
||||
@@ -27,7 +27,7 @@
|
||||
<!-- 右侧:用户列表 -->
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="panel-top">
|
||||
<h2>用户列表</h2>
|
||||
<h2 class="title-bar-heading">用户列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -46,10 +46,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">支持按关键词、状态筛选。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -74,14 +74,6 @@
|
||||
<el-icon><Key /></el-icon>
|
||||
重置密码
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarView"
|
||||
>
|
||||
<el-icon><View /></el-icon>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@@ -100,6 +92,16 @@
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions
|
||||
:loading="loading"
|
||||
:column-defs="listColumnDefs"
|
||||
v-model:visible-columns="visibleColumns"
|
||||
v-model:check-all="checkAll"
|
||||
:is-indeterminate="isIndeterminate"
|
||||
@refresh="loadData"
|
||||
@reset-columns="resetToDefault"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -123,6 +125,7 @@
|
||||
:index="(index: number) => (pagination.page - 1) * pagination.pageSize + index + 1"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('userNo')"
|
||||
prop="userNo"
|
||||
label="用户账号"
|
||||
min-width="120"
|
||||
@@ -135,8 +138,13 @@
|
||||
min-width="100"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.nickName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('deptName')"
|
||||
prop="deptName"
|
||||
label="所属组织"
|
||||
min-width="200"
|
||||
@@ -148,6 +156,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('phoneNo')"
|
||||
prop="phoneNo"
|
||||
label="手机号"
|
||||
min-width="140"
|
||||
@@ -159,6 +168,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('status')"
|
||||
prop="status"
|
||||
label="状态"
|
||||
min-width="80"
|
||||
@@ -172,6 +182,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isColumnVisible('createTime')"
|
||||
prop="createTime"
|
||||
label="创建时间"
|
||||
min-width="180"
|
||||
@@ -288,7 +299,28 @@
|
||||
:icon="UserFilled"
|
||||
:meta="`${viewRow?.deptName || ''}${viewRow?.deptName && viewRow?.createTime ? ' · ' : ''}${viewRow?.createTime || ''}`"
|
||||
:sections="viewSections"
|
||||
/>
|
||||
>
|
||||
<template v-if="viewRow" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleEdit(viewRow)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleHeroResetPwd">
|
||||
<el-icon><Key /></el-icon>
|
||||
重置密码
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewRow)"
|
||||
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleHeroDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
@@ -301,7 +333,6 @@
|
||||
Plus,
|
||||
Close,
|
||||
Check,
|
||||
View,
|
||||
UserFilled,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
@@ -310,6 +341,8 @@
|
||||
Delete
|
||||
} from '@element-plus/icons-vue'
|
||||
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import {
|
||||
fetchUserList,
|
||||
fetchUserDetail,
|
||||
@@ -370,7 +403,23 @@ const dictStore = useDictStore()
|
||||
const tableData = ref<Api.User.UserItem[]>([])
|
||||
const selectedRows = ref<Api.User.UserItem[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
const listColumnDefs = [
|
||||
{ prop: 'userNo', label: '用户账号' },
|
||||
{ prop: 'deptName', label: '所属组织' },
|
||||
{ prop: 'phoneNo', label: '手机号' },
|
||||
{ prop: 'status', label: '状态' },
|
||||
{ prop: 'createTime', label: '创建时间', defaultVisible: false }
|
||||
]
|
||||
|
||||
const {
|
||||
visibleColumns,
|
||||
checkAll,
|
||||
isIndeterminate,
|
||||
isColumnVisible,
|
||||
resetToDefault
|
||||
} = usePersistedListColumns('system-user-list-columns', listColumnDefs)
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('新增用户')
|
||||
@@ -560,11 +609,6 @@ const dictStore = useDictStore()
|
||||
return selectedRows.value[0]
|
||||
}
|
||||
|
||||
function handleToolbarView() {
|
||||
const row = requireSingleSelection('查看')
|
||||
if (row) handleView(row)
|
||||
}
|
||||
|
||||
function handleToolbarEdit() {
|
||||
const row = requireSingleSelection('编辑')
|
||||
if (row) handleEdit(row)
|
||||
@@ -663,6 +707,31 @@ const dictStore = useDictStore()
|
||||
ElMessage.error('加载用户详情失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function handleHeroResetPwd() {
|
||||
if (!viewRow.value) return
|
||||
const row = viewRow.value
|
||||
await ElMessageBox.confirm(`确定将用户「${row.nickName}」的密码重置为 111111 吗?`, '提示', {
|
||||
type: 'warning'
|
||||
})
|
||||
await fetchResetPassword(row.id)
|
||||
ElMessage.success('密码重置成功')
|
||||
}
|
||||
|
||||
async function handleHeroDelete() {
|
||||
if (!viewRow.value) return
|
||||
const row = viewRow.value
|
||||
if (!canDeleteByCreator(row)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
await ElMessageBox.confirm(`确定删除用户「${row.nickName}」吗?`, '提示', { type: 'warning' })
|
||||
await fetchDeleteUser(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
viewVisible.value = false
|
||||
viewRow.value = null
|
||||
await loadData()
|
||||
}
|
||||
// 输入检索条件时自动搜索(防抖 300ms)
|
||||
watchDebounced(
|
||||
searchForm,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>申请列表</h2>
|
||||
<h2 class="title-bar-heading">申请列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -33,10 +33,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按流程名称、业务单号模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -44,6 +44,12 @@
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
@@ -68,7 +74,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleViewDetail(row)">{{ row.processName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="businessTypeLabel"
|
||||
label="业务类型"
|
||||
@@ -102,19 +112,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="160"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item primary" @click="handleViewDetail(row)"
|
||||
><el-icon><View /></el-icon>查看详情</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
@@ -218,16 +215,17 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { fetchMyInstances, fetchBusinessAllTasks } from '@/api/workflow'
|
||||
import ProcessStatusTag from '../components/ProcessStatusTag.vue'
|
||||
import { Document, View, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
|
||||
import { Document, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
|
||||
|
||||
defineOptions({ name: 'WorkflowMyApplications' })
|
||||
|
||||
const searchForm = reactive<{ keyword: string; status: string }>({ keyword: '', status: '' })
|
||||
const tableData = ref<Api.Workflow.MyInstanceItem[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
const detailVisible = ref(false)
|
||||
const detailLoading = ref(false)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>流程列表</h2>
|
||||
<h2 class="title-bar-heading">流程列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -22,10 +22,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按流程名称、编码模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -42,6 +42,32 @@
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增流程
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEdit"
|
||||
>
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarDesign"
|
||||
>
|
||||
<el-icon><SetUp /></el-icon>
|
||||
流程设计
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
|
||||
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
|
||||
@click="handleToolbarDelete"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
@@ -52,6 +78,8 @@
|
||||
<el-icon><Delete /></el-icon>
|
||||
批量删除
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -63,6 +91,7 @@
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
@@ -86,7 +115,12 @@
|
||||
min-width="180"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleView(row)">{{ row.processName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" min-width="100" align="center" header-align="center">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
@@ -109,36 +143,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="160"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button class="btn-op-item primary" @click="handleDesign(row)">
|
||||
<el-icon><SetUp /></el-icon>流程设计
|
||||
</el-button>
|
||||
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="edit">
|
||||
<el-icon><Edit /></el-icon>编辑
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
@@ -204,12 +208,48 @@
|
||||
:process-name="designerDefName"
|
||||
@saved="handleDesignerSaved"
|
||||
/>
|
||||
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewVisible"
|
||||
:title="viewingRecord?.processName || '流程详情'"
|
||||
:icon="SetUp"
|
||||
:code="viewingRecord?.processCode"
|
||||
code-label="流程编码"
|
||||
:sections="processViewSections"
|
||||
>
|
||||
<template v-if="viewingRecord" #hero-actions>
|
||||
<el-button class="btn-main" type="primary" @click="handleDesign(viewingRecord)">
|
||||
<el-icon><SetUp /></el-icon>
|
||||
流程设计
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="handleEdit(viewingRecord)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
type="danger"
|
||||
:disabled="!canDeleteByCreator(viewingRecord)"
|
||||
:title="canDeleteByCreator(viewingRecord) ? '' : CREATOR_DELETE_TIP"
|
||||
@click="handleDelete(viewingRecord)"
|
||||
>
|
||||
<el-icon><Delete /></el-icon>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import {
|
||||
canDeleteByCreator,
|
||||
filterDeletableByCreator,
|
||||
allRowsDeletableByCreator,
|
||||
CREATOR_DELETE_TIP
|
||||
} from '@/utils/creator-delete'
|
||||
import {
|
||||
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
|
||||
Plus,
|
||||
Close,
|
||||
Check,
|
||||
@@ -217,8 +257,7 @@
|
||||
RefreshLeft,
|
||||
Delete,
|
||||
SetUp,
|
||||
Edit,
|
||||
More
|
||||
Edit
|
||||
} from '@element-plus/icons-vue'
|
||||
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
|
||||
import {
|
||||
@@ -228,6 +267,10 @@
|
||||
fetchDeleteProcessDef
|
||||
} from '@/api/workflow'
|
||||
import FlowDesigner from '../designer/FlowDesigner.vue'
|
||||
import SystemViewDialog, {
|
||||
type ViewField,
|
||||
type ViewSection
|
||||
} from '@/components/business/system-view-dialog/index.vue'
|
||||
|
||||
defineOptions({ name: 'WorkflowProcess' })
|
||||
|
||||
@@ -235,7 +278,7 @@
|
||||
const tableData = ref<Api.Workflow.ProcessDefItem[]>([])
|
||||
const selectedRows = ref<Api.Workflow.ProcessDefItem[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
// 新增/编辑
|
||||
const dialogVisible = ref(false)
|
||||
@@ -262,6 +305,31 @@
|
||||
const designerDefId = ref('')
|
||||
const designerDefName = ref('')
|
||||
|
||||
// 查看
|
||||
const viewVisible = ref(false)
|
||||
const viewingRecord = ref<Api.Workflow.ProcessDefItem | null>(null)
|
||||
|
||||
const processViewSections = computed<ViewSection[]>(() => {
|
||||
const row = viewingRecord.value
|
||||
if (!row) return []
|
||||
const fields: ViewField[] = [
|
||||
{ label: '流程编码', value: row.processCode || '--' },
|
||||
{ label: '流程名称', value: row.processName || '--' },
|
||||
{
|
||||
label: '状态',
|
||||
value: row.status === '1' ? '启用' : '停用',
|
||||
tagType: row.status === '1' ? 'success' : 'info'
|
||||
},
|
||||
{
|
||||
label: '最新版本',
|
||||
value: row.latestVersion != null ? `V${row.latestVersion}` : '--'
|
||||
},
|
||||
{ label: '创建时间', value: row.createTime || '--' },
|
||||
{ label: '备注', value: row.remark || '--', colSpan: 2 }
|
||||
]
|
||||
return [{ title: '基本信息', fields }]
|
||||
})
|
||||
|
||||
const handleSelectionChange = (rows: Api.Workflow.ProcessDefItem[]) => {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
@@ -353,21 +421,46 @@
|
||||
await loadData()
|
||||
}
|
||||
|
||||
function handleDropdownCommand(command: string, row: Api.Workflow.ProcessDefItem) {
|
||||
switch (command) {
|
||||
case 'edit': handleEdit(row); break
|
||||
case 'delete': handleDelete(row); break
|
||||
}
|
||||
function handleView(row: Api.Workflow.ProcessDefItem) {
|
||||
viewingRecord.value = row
|
||||
viewVisible.value = true
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Workflow.ProcessDefItem)
|
||||
function handleToolbarEdit() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条流程')
|
||||
return
|
||||
}
|
||||
handleEdit(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDesign() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条流程')
|
||||
return
|
||||
}
|
||||
handleDesign(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleToolbarDelete() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条流程')
|
||||
return
|
||||
}
|
||||
handleDelete(selectedRows.value[0])
|
||||
}
|
||||
|
||||
async function handleDelete(row: Api.Workflow.ProcessDefItem) {
|
||||
if (!canDeleteByCreator(row)) {
|
||||
ElMessage.warning(CREATOR_DELETE_TIP)
|
||||
return
|
||||
}
|
||||
{
|
||||
await ElMessageBox.confirm('确定要删除该流程吗?', '提示', { type: 'warning' })
|
||||
await fetchDeleteProcessDef(row.id)
|
||||
if (viewingRecord.value?.id === row.id) {
|
||||
viewVisible.value = false
|
||||
viewingRecord.value = null
|
||||
}
|
||||
await loadData()
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>已办列表</h2>
|
||||
<h2 class="title-bar-heading">已办列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -21,10 +21,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按流程名称模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -32,6 +32,12 @@
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
@@ -55,7 +61,11 @@
|
||||
min-width="160"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleViewDetail(row)">{{ row.processName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="businessTypeLabel"
|
||||
label="业务类型"
|
||||
@@ -98,19 +108,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="260"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item primary" @click="handleViewDetail(row)"
|
||||
><el-icon><View /></el-icon>查看详情</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
@@ -216,16 +213,17 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { fetchCompletedTasks, fetchInstanceDetail } from '@/api/workflow'
|
||||
import ProcessStatusTag from '../components/ProcessStatusTag.vue'
|
||||
import { Document, View, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
|
||||
import { Document, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
|
||||
|
||||
defineOptions({ name: 'WorkflowTaskCompleted' })
|
||||
|
||||
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
|
||||
const tableData = ref<Api.Workflow.TaskItem[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
// 详情
|
||||
const detailVisible = ref(false)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2>待办列表</h2>
|
||||
<h2 class="title-bar-heading">待办列表</h2>
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
@@ -21,10 +21,10 @@
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">按流程名称模糊查询。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
@@ -32,6 +32,25 @@
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarApprove"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>
|
||||
审批
|
||||
</el-button>
|
||||
|
||||
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
@@ -39,8 +58,10 @@
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleViewDetail"
|
||||
>
|
||||
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
@@ -56,7 +77,11 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="handleViewDetail(row)">{{ row.processName }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="businessTypeLabel"
|
||||
label="业务类型"
|
||||
@@ -86,22 +111,6 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
min-width="260"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button class="btn-op-item primary" @click="handleApprove(row)"
|
||||
><el-icon><EditPen /></el-icon>审批</el-button
|
||||
>
|
||||
<el-button class="btn-op-item" @click="handleViewDetail(row)"
|
||||
><el-icon><View /></el-icon>查看详情</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
@@ -156,6 +165,12 @@
|
||||
{{ detailData.createTime || '--' }}
|
||||
</p>
|
||||
</div>
|
||||
<div v-if="viewingRow" class="view-hero-actions">
|
||||
<el-button class="btn-main" type="primary" @click="handleApprove(viewingRow)">
|
||||
<el-icon><EditPen /></el-icon>
|
||||
审批
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
@@ -215,17 +230,19 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import { fetchPendingTasks, fetchInstanceDetail } from '@/api/workflow'
|
||||
import ApprovalDialog from '../components/ApprovalDialog.vue'
|
||||
import ProcessStatusTag from '../components/ProcessStatusTag.vue'
|
||||
import { Document, EditPen, View, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
|
||||
import { Document, EditPen, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
|
||||
|
||||
defineOptions({ name: 'WorkflowTaskPending' })
|
||||
|
||||
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
|
||||
const tableData = ref<Api.Workflow.TaskItem[]>([])
|
||||
const selectedRows = ref<Api.Workflow.TaskItem[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
|
||||
|
||||
// 审批
|
||||
const approvalVisible = ref(false)
|
||||
@@ -236,6 +253,11 @@
|
||||
const detailVisible = ref(false)
|
||||
const detailLoading = ref(false)
|
||||
const detailData = ref<Api.Workflow.InstanceDetail | null>(null)
|
||||
const viewingRow = ref<Api.Workflow.TaskItem | null>(null)
|
||||
|
||||
function handleSelectionChange(rows: Api.Workflow.TaskItem[]) {
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
async function loadData() {
|
||||
loading.value = true
|
||||
@@ -263,6 +285,14 @@
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleToolbarApprove() {
|
||||
if (selectedRows.value.length !== 1) {
|
||||
ElMessage.warning('请选择一条待办任务')
|
||||
return
|
||||
}
|
||||
handleApprove(selectedRows.value[0])
|
||||
}
|
||||
|
||||
function handleApprove(row: Api.Workflow.TaskItem) {
|
||||
approvalTaskId.value = row.id
|
||||
approvalInstanceId.value = row.instanceId || ''
|
||||
@@ -274,6 +304,7 @@
|
||||
}
|
||||
|
||||
async function handleViewDetail(row: Api.Workflow.TaskItem) {
|
||||
viewingRow.value = row
|
||||
detailVisible.value = true
|
||||
detailLoading.value = true
|
||||
detailData.value = null
|
||||
@@ -336,6 +367,16 @@
|
||||
background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 55%);
|
||||
border-bottom: 1px solid #d9e8e2;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.view-hero-actions {
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.view-hero-icon {
|
||||
|
||||
Reference in new issue
Block a user