审核添加 合同显示 及日志

This commit is contained in:
浅念
2025-10-23 15:23:23 +08:00
parent 2ba64b94b0
commit cd1bbca4a6
5 changed files with 521 additions and 90 deletions
+46
View File
@@ -0,0 +1,46 @@
import request from '@/utils/http'
export class logService {
// 更新日志-列表
static getChangelogList(params: Api.Common.PaginatingParams) {
return request.get<Api.Common.CommonListData>({
url: '/admin/update/log/list',
params
})
}
// 更新日志-添加
static addChangelog(params: any) {
return request.post<Api.Common.AddResponse>({
url: '/admin/update/log/store',
params
})
}
// 更新日志-删除
static deleteChangelog(params: any) {
return request.post<Api.Common.AddResponse>({
url: '/admin/update/log/destroy',
params
})
}
// 更新日志-详情
static detailChangelog(params: any) {
return request.get<any>({
url: '/admin/update/log/show',
params
})
}
// 更新日志-修改
static updateChangelog(params: any) {
return request.post<Api.Common.AddResponse>({
url: '/admin/update/log/update',
params
})
}
//操作日志-列表
static getOperationLogList(params: Api.Common.PaginatingParams) {
return request.get<Api.Common.CommonListData>({
url: '/admin/op/log/list',
params
})
}
}
@@ -10,43 +10,17 @@
</div>
<!-- 上传合同 -->
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">上传合同</span>
</div>
<div class="file-preview">
<div v-if="contractFile" class="contract-file">
<div v-if="isImageFile(contractFile)" class="image-preview">
<img
:src="contractFile.url"
:alt="contractFile.name"
class="preview-image"
@click="previewImage(contractFile)"
/>
<div class="file-info">
<span class="file-name">{{ contractFile.name }}</span>
<el-button type="text" size="small" @click="previewImage(contractFile)">
预览
</el-button>
</div>
</div>
<div v-else class="document-preview">
<div class="file-icon">
<i class="iconfont-sys">&#xe814;</i>
</div>
<div class="file-info">
<span class="file-name">{{ contractFile.name }}</span>
<el-button type="primary" size="small" @click="downloadFile(contractFile)">
下载
</el-button>
</div>
</div>
</div>
<div v-else class="no-file">
<i class="iconfont-sys">&#xe60c;</i>
<span>暂无合同文件</span>
</div>
</div>
<FilePreview title="合同文件" :files="contractFiles" empty-text="暂无合同文件" />
</div>
<!-- PI文件 -->
<div class="boxshadow">
<FilePreview title="PI文件" :files="piFiles" empty-text="暂无PI文件" />
</div>
<!-- 水单文件 -->
<div class="boxshadow">
<FilePreview title="水单文件" :files="waterBillFiles" empty-text="暂无水单文件" />
</div>
<div class="boxshadow">
<div class="form-title">
@@ -178,6 +152,7 @@
import { usePdfPreview } from '@/composables/usePdfPreview'
import OrderDetailContent from '@/components/custom/OrderDetailContent.vue'
import ProcurementDetailView from '@/components/custom/ProcurementDetailView.vue'
import FilePreview from '@/components/custom/FilePreview.vue'
import type { OrderData } from '@/composables/useOrderDetailDialog'
import { router } from '@/router'
defineOptions({ name: 'AdminStockingAuthDetil' })
@@ -258,7 +233,20 @@
}
// 合同文件
const contractFile = ref<{ name: string; url: string; file_name: string } | null>(null)
// 文件数据
const contractFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const piFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const waterBillFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
// 处理文件数据
const processFiles = (files: any[], type: string) => {
if (!files || !Array.isArray(files)) return []
return files.map((file: any) => ({
name: `${type}文件`,
url: file.file_full_url || file.file_url,
file_name: file.file_url
}))
}
function extractFileName(pathOrUrl: string | undefined | null): string {
if (!pathOrUrl) return '合同文件'
try {
@@ -291,13 +279,26 @@
orderData.contract_file_url = list
orderDialog.orderData = orderData
}
// 合同文件
if (res?.contract) {
contractFile.value = {
name: '合同文件',
url: res.contract_url || res.contract,
file_name: res.contract
}
// 处理合同文件
const file_list = res?.file_list
if (file_list?.contract) {
contractFiles.value = processFiles(file_list.contract, '合同')
} else {
contractFiles.value = []
}
// 处理PI文件
if (file_list?.pi_doc) {
piFiles.value = processFiles(file_list.pi_doc, 'PI')
} else {
piFiles.value = []
}
// 处理水单文件
if (file_list?.transaction_slip) {
waterBillFiles.value = processFiles(file_list.transaction_slip, '水单')
} else {
waterBillFiles.value = []
}
// 审批记录(兼容多种字段)
const resstockapprovallogs = await manageService.stockapprovallogs({ instance_id: instance_id })
+287
View File
@@ -0,0 +1,287 @@
<template>
<div class="customer-page">
<div class="customer-toolbar boxshadow">
<div class="customer-search-group">
<el-form-item label="关键字:" label-width="70px">
<el-input style="min-width: 120px" v-model="keyword" placeholder="请输入关键字" />
</el-form-item>
</div>
</div>
<div class="boxshadow">
<ElRow>
<div style="width: 12px"></div>
<ElCol :xs="24" :sm="12" :lg="6" class="el-col2">
<ElButton @click="showDialog('add')" v-ripple v-if="hasAuth('changelog@add')"
>新增</ElButton
>
</ElCol>
</ElRow>
<ArtTable
ref="tableRef"
row-key="id"
:loading="loading"
:data="tableData"
:currentPage="pagination.currentPage"
:pageSize="pagination.pageSize"
:total="pagination.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<template #default>
<ElTableColumn label="编号" prop="id" width="100px" />
<el-table-column prop="id" label="内容">
<template #default="scope">
<span v-html="scope.row.content" style="white-space: pre-line"></span>
</template>
</el-table-column>
<ElTableColumn label="发布时间" prop="update_time" />
<ElTableColumn label="备注" prop="remark" />
<ElTableColumn fixed="right" label="操作" width="200px">
<template #default="scope">
<ElRow>
<el-button
link
@click="showDialog('edit', scope.row)"
v-if="hasAuth('changelog@edit')"
>编辑</el-button
>
<el-button
type="danger"
link
@click="deleteRole(scope.row)"
v-if="hasAuth('changelog@del')"
>
删除
</el-button>
</ElRow>
</template>
</ElTableColumn>
</template>
</ArtTable>
</div>
<ElDialog v-model="dialogVisible" :title="dialogType === 'add' ? '新增' : '编辑'" align-center>
<ElForm ref="formRef" :model="form" :rules="rules" label-width="80px" class="form">
<ElFormItem label="发布日期" prop="update_time">
<ElDatePicker
v-model="form.update_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择发布日期"
style="width: 100%"
/>
</ElFormItem>
<ElFormItem label="更新内容" prop="content">
<ElInput v-model="form.content" type="textarea" :rows="3" placeholder="请输入通知内容" />
</ElFormItem>
<ElFormItem label="备注" prop="remark">
<ElInput v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注" />
</ElFormItem>
</ElForm>
<template #footer>
<div class="dialog-footer">
<ElButton @click="dialogVisible = false">取消</ElButton>
<ElButton type="primary" @click="handleSubmit(formRef)">提交</ElButton>
</div>
</template>
</ElDialog>
</div>
</template>
<script setup lang="ts">
import { ElMessage, ElMessageBox } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
import { logService } from '@/api/admin/log'
import { useAuth } from '@/composables/useAuth'
const { hasAuth } = useAuth()
defineOptions({ name: 'Changelog' })
const loading = ref(false)
const dialogVisible = ref(false)
const formRef = ref<FormInstance>()
const { width } = useWindowSize()
const keyword = ref<string>('')
const isMobile = computed(() => width.value < 500)
const rules = reactive<FormRules>({
name: [{ required: true, message: '请输入公司名称', trigger: 'blur' }],
abbr: [{ required: true, message: '请输入公司简称', trigger: 'blur' }]
// tenant_key: [{ required: true, message: '请输入飞书标识', trigger: 'blur' }]
})
const form = reactive<any>({
id: '',
content: '',
update_time: '',
remark: ''
})
const pagination = reactive({
currentPage: 1,
pageSize: 10,
total: 0
})
// 表格数据
const tableData = ref<any[]>([])
// 表格实例引用
const tableRef = ref()
onMounted(() => {
getWorkList()
})
watch([keyword], () => {
pagination.currentPage = 1
getWorkList()
})
// 处理表格分页变化
const handleSizeChange = (newPageSize: number) => {
pagination.pageSize = newPageSize
getWorkList()
}
const handleCurrentChange = (newCurrentPage: number) => {
pagination.currentPage = newCurrentPage
getWorkList()
}
// 获取列表数据
const getWorkList = async () => {
loading.value = true
try {
const { currentPage, pageSize } = pagination
const { records, current, size, total } = await logService.getChangelogList({
current: currentPage,
size: pageSize
})
tableData.value = records.map((item: any) => ({
...item
}))
Object.assign(pagination, { currentPage: current, pageSize: size, total })
} catch (error) {
console.error('获取列表失败:', error)
} finally {
loading.value = false
}
}
const dialogType = ref('add')
const showDialog = (type: string, row?: any) => {
dialogVisible.value = true
dialogType.value = type
if (type === 'edit' && row) {
form.content = row.content
form.update_time = row.update_time
form.remark = row.remark
form.id = row.id
// form.tenant_key = row.tenant_key
} else {
form.id = ''
form.content = ''
form.update_time = ''
form.remark = ''
}
}
const deleteRole = (row?: any) => {
ElMessageBox.confirm('确定删除吗?', '删除确认', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error'
}).then(async () => {
const { message } = await logService.deleteChangelog({
id: row.id
})
ElMessage.success(message)
getWorkList()
})
}
const handleSubmit = async (formEl: FormInstance | undefined) => {
if (!formEl) return
if (dialogType.value === 'add') {
const { message } = await logService.addChangelog({
content: form.content,
update_time: form.update_time,
remark: form.remark
})
ElMessage.success(message)
dialogVisible.value = false
getWorkList()
} else {
const { message } = await logService.updateChangelog(form)
ElMessage.success(message)
dialogVisible.value = false
getWorkList()
}
}
</script>
<style lang="scss" scoped>
:deep(.el-table__empty-block) {
height: 100% !important;
min-height: 200px;
display: flex;
align-items: center;
justify-content: center;
}
.customer-page {
background: var(--art-main-bg-color);
min-height: 100vh;
}
.page-content {
.svg-icon {
width: 1.8em;
height: 1.8em;
overflow: hidden;
vertical-align: -8px;
fill: currentcolor;
}
}
.customer-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
padding: 20px 20px;
background: var(--art-main-bg-color);
}
.customer-search-group {
display: flex;
gap: 12px;
}
.message-text {
padding: 10px 14px;
line-height: 1.7;
white-space: pre-line;
word-break: break-word;
}
.detail-dialog {
display: flex;
flex-direction: column;
gap: 16px;
}
.section {
background: var(--el-fill-color-blank);
border: 1px solid var(--el-border-color-light);
border-radius: 8px;
padding: 12px 14px;
}
.info-grid {
display: grid;
grid-template-columns: 96px 1fr;
gap: 6px 12px;
align-items: center;
padding: 6px 0;
}
.label {
color: var(--el-text-color-secondary);
font-size: 13px;
}
.value {
color: var(--el-text-color-primary);
font-size: 14px;
}
.content-box {
background: var(--el-fill-color-lighter);
border: 1px dashed var(--el-border-color);
border-radius: 8px;
padding: 10px 12px;
max-height: 320px;
overflow: auto;
}
</style>
+97
View File
@@ -0,0 +1,97 @@
<template>
<div class="page-content">
<ArtTable
ref="tableRef"
row-key="id"
:loading="loading"
:data="tableData"
:currentPage="pagination.currentPage"
:pageSize="pagination.pageSize"
:total="pagination.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
<template #default>
<ElTableColumn label="ID" prop="id" />
<ElTableColumn label="操作人" prop="user_name" />
<ElTableColumn label="请求路由" prop="route" />
<ElTableColumn label="用户ip" prop="ip" />
<ElTableColumn label="用户ua" prop="ua" />
<ElTableColumn label="入参摘要" prop="params_brief" />
<ElTableColumn label="异常" prop="message" />
<ElTableColumn label="创建时间" prop="created_at" />
</template>
</ArtTable>
</div>
</template>
<script setup lang="ts">
import { ElMessage, ElMessageBox } from 'element-plus'
import { logService } from '@/api/admin/log'
import { useAuth } from '@/composables/useAuth'
const { hasAuth } = useAuth()
defineOptions({ name: 'Operationlog' })
const loading = ref(false)
const pagination = reactive({
currentPage: 1,
pageSize: 10,
total: 0
})
// 表格数据
const tableData = ref<any[]>([])
// 表格实例引用
const tableRef = ref()
onMounted(() => {
getWorkList()
})
// 处理表格分页变化
const handleSizeChange = (newPageSize: number) => {
pagination.pageSize = newPageSize
getWorkList()
}
const handleCurrentChange = (newCurrentPage: number) => {
pagination.currentPage = newCurrentPage
getWorkList()
}
// 获取列表数据
const getWorkList = async () => {
loading.value = true
try {
const { currentPage, pageSize } = pagination
const { records, current, size, total } = await logService.getOperationLogList({
current: currentPage,
size: pageSize
})
tableData.value = records.map((item: any) => ({
...item
}))
Object.assign(pagination, { currentPage: current, pageSize: size, total })
} catch (error) {
console.error('获取列表失败:', error)
} finally {
loading.value = false
}
}
</script>
<style lang="scss" scoped>
:deep(.el-table__empty-block) {
height: 100% !important;
min-height: 200px;
display: flex;
align-items: center;
justify-content: center;
}
.page-content {
.svg-icon {
width: 1.8em;
height: 1.8em;
overflow: hidden;
vertical-align: -8px;
fill: currentcolor;
}
}
</style>
+45 -45
View File
@@ -8,45 +8,19 @@
<ProcurementDetailView :detailData="orderDialog.orderData" />
</div>
</div>
<!-- 上传合同 -->
<!-- 合同文件 -->
<div class="boxshadow">
<div class="form-title">
<span class="border"></span>
<span class="title">上传合同</span>
</div>
<div class="file-preview">
<div v-if="contractFile" class="contract-file">
<div v-if="isImageFile(contractFile)" class="image-preview">
<img
:src="contractFile.url"
:alt="contractFile.name"
class="preview-image"
@click="previewImage(contractFile)"
/>
<div class="file-info">
<span class="file-name">{{ contractFile.name }}</span>
<el-button type="text" size="small" @click="previewImage(contractFile)">
预览
</el-button>
</div>
</div>
<div v-else class="document-preview">
<div class="file-icon">
<i class="iconfont-sys">&#xe814;</i>
</div>
<div class="file-info">
<span class="file-name">{{ contractFile.name }}</span>
<el-button type="primary" size="small" @click="downloadFile(contractFile)">
下载
</el-button>
</div>
</div>
</div>
<div v-else class="no-file">
<i class="iconfont-sys">&#xe60c;</i>
<span>暂无合同文件</span>
</div>
</div>
<FilePreview title="合同文件" :files="contractFiles" empty-text="暂无合同文件" />
</div>
<!-- PI文件 -->
<div class="boxshadow">
<FilePreview title="PI文件" :files="piFiles" empty-text="暂无PI文件" />
</div>
<!-- 水单文件 -->
<div class="boxshadow">
<FilePreview title="水单文件" :files="waterBillFiles" empty-text="暂无水单文件" />
</div>
<div class="boxshadow">
<div class="form-title">
@@ -169,6 +143,7 @@
import { usePdfPreview } from '@/composables/usePdfPreview'
import OrderDetailContent from '@/components/custom/OrderDetailContent.vue'
import ProcurementDetailView from '@/components/custom/ProcurementDetailView.vue'
import FilePreview from '@/components/custom/FilePreview.vue'
import type { OrderData } from '@/composables/useOrderDetailDialog'
import { router } from '@/router'
defineOptions({ name: 'CrmApprovalDetail' })
@@ -249,7 +224,20 @@
}
// 合同文件
const contractFile = ref<{ name: string; url: string; file_name: string } | null>(null)
// 文件数据
const contractFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const piFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
const waterBillFiles = ref<Array<{ name: string; url: string; file_name: string }>>([])
// 处理文件数据
const processFiles = (files: any[], type: string) => {
if (!files || !Array.isArray(files)) return []
return files.map((file: any) => ({
name: `${type}文件`,
url: file.file_full_url || file.file_url,
file_name: file.file_url
}))
}
function extractFileName(pathOrUrl: string | undefined | null): string {
if (!pathOrUrl) return '合同文件'
try {
@@ -283,12 +271,24 @@
orderDialog.orderData = orderData
}
// 合同文件
if (res?.contract) {
contractFile.value = {
name: '合同文件',
url: res.contract_url || res.contract,
file_name: res.contract
}
// 处理合同文件
const file_list = res?.file_list
if (file_list?.contract) {
contractFiles.value = processFiles(file_list.contract, '合同')
} else {
contractFiles.value = []
}
// 处理PI文件
if (file_list?.pi_doc) {
piFiles.value = processFiles(file_list.pi_doc, 'PI')
} else {
piFiles.value = []
}
// 处理水单文件
if (file_list?.transaction_slip) {
waterBillFiles.value = processFiles(file_list.transaction_slip, '水单')
} else {
waterBillFiles.value = []
}
// 审批记录(兼容多种字段)
const resstockapprovallogs = await CrmService.stockapprovallogs({ instance_id: instance_id })