客户管理记录修改日志
This commit is contained in:
@@ -17,6 +17,15 @@ export function getCustomer(customerId) {
|
||||
})
|
||||
}
|
||||
|
||||
// 查询客户业务操作日志
|
||||
export function listCustomerLog(customerId) {
|
||||
return request({
|
||||
url: '/customersupplier/customerinfo/log/list',
|
||||
method: 'get',
|
||||
params: { customerId }
|
||||
})
|
||||
}
|
||||
|
||||
// 新增客户主
|
||||
export function addCustomer(data) {
|
||||
return request({
|
||||
|
||||
@@ -85,6 +85,16 @@
|
||||
|
||||
>客户余额</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="info"
|
||||
plain
|
||||
icon="Document"
|
||||
:disabled="single"
|
||||
@click="handleViewLog()"
|
||||
v-hasPermi="['customersupplier:customerinfo:query']"
|
||||
>日志</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
@@ -167,11 +177,12 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="isColVisible('remark')" label="备注说明" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="240" fixed="right">
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="290" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['customersupplier:customerinfo:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['customersupplier:customerinfo:remove']">删除</el-button>
|
||||
<el-button link type="primary" icon="Wallet" @click="handleCustomerMoney(scope.row)">客户余额</el-button>
|
||||
<el-button link type="primary" icon="Document" @click="handleViewLog(scope.row)" v-hasPermi="['customersupplier:customerinfo:query']">日志</el-button>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
@@ -184,11 +195,62 @@
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 客户业务操作日志弹窗 -->
|
||||
<el-dialog v-model="logOpen" :title="`业务日志 - ${logCustomer.customerName || ''}`" width="820px" append-to-body>
|
||||
<div style="margin-bottom: 10px; color: #909399; font-size: 13px;">
|
||||
客户编码:{{ logCustomer.customerCode || '-' }}
|
||||
<span style="margin-left: 16px;">共 {{ logList.length }} 条日志(按操作时间倒序)</span>
|
||||
</div>
|
||||
<el-table v-loading="logLoading" :data="logList" border size="small" row-key="logId" :empty-text="'暂无业务日志'">
|
||||
<el-table-column type="expand">
|
||||
<template #default="scope">
|
||||
<div style="padding: 8px 16px; background: #fafafa;">
|
||||
<div v-if="!scope.row.changes || !scope.row.changes.length" style="color:#909399;">无字段明细</div>
|
||||
<el-table v-else :data="scope.row.changes" border size="small">
|
||||
<el-table-column label="字段" prop="fieldLabel" width="180" align="center" />
|
||||
<el-table-column label="修改前" align="center">
|
||||
<template #default="cell">
|
||||
<span :style="{ color: cell.row.oldValue === '' ? '#909399' : '' }">{{ cell.row.oldValue === '' ? '(空)' : cell.row.oldValue }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="修改后" align="center">
|
||||
<template #default="cell">
|
||||
<span :style="{ color: cell.row.newValue === '' ? '#909399' : '' }">{{ cell.row.newValue === '' ? '(空)' : cell.row.newValue }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作类型" align="center" width="90">
|
||||
<template #default="scope">
|
||||
<el-tag :type="opTagType(scope.row.operationType)" size="small">{{ opLabel(scope.row.operationType) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作人" align="center" width="150">
|
||||
<template #default="scope">{{ scope.row.createByName || scope.row.createBy || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作时间" align="center" width="170">
|
||||
<template #default="scope">{{ fmtTime(scope.row.createTime) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="变更字段" align="center">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.operationType === '1'">新建客户,录入 {{ scope.row.changes?.length || 0 }} 项信息</span>
|
||||
<span v-else-if="scope.row.operationType === '2'">{{ changeSummary(scope.row.changes) }}</span>
|
||||
<span v-else style="color:#f56c6c;">客户被删除</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<el-button @click="logOpen = false">关 闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Customer">
|
||||
import { listCustomer, delCustomer } from "@/api/customersuppliermanagement/customerinfo/customer.js"
|
||||
import { listCustomer, delCustomer, listCustomerLog } from "@/api/customersuppliermanagement/customerinfo/customer.js"
|
||||
import { useProducts, parseProductCodes } from '@/components/ProductSelect/useProducts'
|
||||
import { useColumnSettings } from '@/utils/columnSettings'
|
||||
|
||||
@@ -359,5 +421,49 @@ function handleExport() {
|
||||
}, `customer_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
/** ========== 客户业务操作日志 ========== */
|
||||
const logOpen = ref(false)
|
||||
const logLoading = ref(false)
|
||||
const logList = ref([])
|
||||
const logCustomer = ref({})
|
||||
|
||||
const OP_META = {
|
||||
'1': { label: '新建', tag: 'success' },
|
||||
'2': { label: '修改', tag: 'warning' },
|
||||
'3': { label: '删除', tag: 'danger' }
|
||||
}
|
||||
function opLabel(type) {
|
||||
return OP_META[type]?.label || '未知'
|
||||
}
|
||||
function opTagType(type) {
|
||||
return OP_META[type]?.tag || 'info'
|
||||
}
|
||||
function fmtTime(t) {
|
||||
return t ? proxy.parseTime(t, '{y}-{m}-{d} {h}:{i}:{s}') : '-'
|
||||
}
|
||||
/** 修改日志的变更字段摘要 */
|
||||
function changeSummary(changes) {
|
||||
if (!changes || !changes.length) return '-'
|
||||
return changes.map(c => c.fieldLabel).join('、')
|
||||
}
|
||||
|
||||
/** 打开业务日志弹窗(操作列传 row;工具栏按钮取勾选行) */
|
||||
function handleViewLog(row) {
|
||||
const target = (row && row.customerId) ? row : selectedRows.value[0]
|
||||
if (!target || !target.customerId) {
|
||||
proxy.$modal.msgWarning("请先勾选一个客户")
|
||||
return
|
||||
}
|
||||
logCustomer.value = { customerId: target.customerId, customerName: target.customerName, customerCode: target.customerCode }
|
||||
logList.value = []
|
||||
logOpen.value = true
|
||||
logLoading.value = true
|
||||
listCustomerLog(target.customerId).then(res => {
|
||||
logList.value = res.data || []
|
||||
}).finally(() => {
|
||||
logLoading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user