1
This commit is contained in:
@@ -158,3 +158,21 @@ export function getDocSheetList(fileId) {
|
||||
})
|
||||
}
|
||||
|
||||
// 查询操作日志列表
|
||||
export function getOperationLogs(params) {
|
||||
return request({
|
||||
url: '/jarvis/tendoc/operationLogs',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 查询最近的操作日志
|
||||
export function getRecentLogs(params) {
|
||||
return request({
|
||||
url: '/jarvis/tendoc/recentLogs',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="商品类型" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="(scope.row.owner === 'g' || (!scope.row.popId && scope.row.owner !== 'pop')) ? 'success' : 'warning'">
|
||||
{{ (scope.row.owner === 'g' || (!scope.row.popId && scope.row.owner !== 'pop')) ? '自营' : 'POP' }}
|
||||
<el-tag :type="(scope.row.owner === 'g' || scope.row.owner === 'G') ? 'success' : 'warning'">
|
||||
{{ (scope.row.owner === 'g' || scope.row.owner === 'G') ? '自营' : 'POP' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -88,14 +88,14 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="佣金比例" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.commissionShare || scope.row.commission">{{ (scope.row.commissionShare || scope.row.commission) }}%</span>
|
||||
<span v-if="scope.row.commissionShare">{{ scope.row.commissionShare }}%</span>
|
||||
<span v-else style="color: #909399;">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="佣金金额" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.commission">
|
||||
¥{{ formatCommissionAmount(scope.row.commission, scope.row.price) }}
|
||||
¥{{ formatPrice(scope.row.commission) }}
|
||||
</span>
|
||||
<span v-else style="color: #909399;">-</span>
|
||||
</template>
|
||||
@@ -126,8 +126,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="类型" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="(scope.row.owner === 'g' || (!scope.row.popId && scope.row.owner !== 'pop')) ? 'success' : 'warning'">
|
||||
{{ (scope.row.owner === 'g' || (!scope.row.popId && scope.row.owner !== 'pop')) ? '自营' : 'POP' }}
|
||||
<el-tag :type="(scope.row.owner === 'g' || scope.row.owner === 'G') ? 'success' : 'warning'">
|
||||
{{ (scope.row.owner === 'g' || scope.row.owner === 'G') ? '自营' : 'POP' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -413,8 +413,9 @@ export default {
|
||||
this.form.selectedProduct = product
|
||||
this.form.queryResult = product
|
||||
this.form.skuName = product.skuName || product.title || product.productName || product.cleanSkuName || ''
|
||||
const ownerValue = product.owner || (product.popId ? 'pop' : 'g') || 'g'
|
||||
this.form.owner = ownerValue === 'p' ? 'pop' : (ownerValue === 'pop' ? 'pop' : 'g')
|
||||
const ownerValue = product.owner || 'g'
|
||||
// owner: 'g'/'G' = 自营, 'p'/'pop' = POP
|
||||
this.form.owner = (ownerValue === 'g' || ownerValue === 'G') ? 'g' : 'pop'
|
||||
|
||||
this.$modal.msgSuccess('已选择商品:' + this.form.skuName + '(' + (this.form.owner === 'g' ? '自营' : 'POP') + ')')
|
||||
},
|
||||
@@ -491,8 +492,9 @@ export default {
|
||||
this.form.selectedProduct = selectedProduct
|
||||
this.form.queryResult = selectedProduct
|
||||
this.form.skuName = selectedProduct.skuName || selectedProduct.title || selectedProduct.productName || selectedProduct.cleanSkuName || ''
|
||||
const ownerValue = selectedProduct.owner || (selectedProduct.popId ? 'pop' : 'g') || 'g'
|
||||
this.form.owner = ownerValue === 'p' ? 'pop' : (ownerValue === 'pop' ? 'pop' : 'g')
|
||||
const ownerValue = selectedProduct.owner || 'g'
|
||||
// owner: 'g'/'G' = 自营, 'p'/'pop' = POP
|
||||
this.form.owner = (ownerValue === 'g' || ownerValue === 'G') ? 'g' : 'pop'
|
||||
|
||||
// 调用批量创建和替换
|
||||
await this.handleReplace()
|
||||
@@ -509,8 +511,10 @@ export default {
|
||||
return Number(price).toFixed(2)
|
||||
},
|
||||
|
||||
/** 格式化佣金金额 */
|
||||
/** 格式化佣金金额(已废弃:commission字段本身就是佣金金额,不需要计算) */
|
||||
formatCommissionAmount(commission, price) {
|
||||
// 已废弃:commission 字段已经是佣金金额(如 86.67),不是百分比
|
||||
// 直接使用 formatPrice(scope.row.commission) 即可
|
||||
if (!commission || !price) return '0.00'
|
||||
// commission可能是百分比字符串或数值
|
||||
let commissionPercent = 0
|
||||
|
||||
@@ -170,6 +170,9 @@
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<div slot="footer">
|
||||
<el-button @click="showOperationLogs = true" icon="el-icon-document" type="info" plain>
|
||||
查看操作日志
|
||||
</el-button>
|
||||
<el-button @click="handleTest" :loading="testLoading" icon="el-icon-setting">
|
||||
测试配置
|
||||
</el-button>
|
||||
@@ -181,6 +184,13 @@
|
||||
保存配置
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 操作日志查看对话框 -->
|
||||
<tencent-doc-operation-logs
|
||||
v-model="showOperationLogs"
|
||||
:file-id="form.fileId"
|
||||
:sheet-id="form.sheetId"
|
||||
/>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -193,9 +203,13 @@ import {
|
||||
getDocSheetList,
|
||||
getTencentDocAuthUrl
|
||||
} from '@/api/jarvis/tendoc'
|
||||
import TencentDocOperationLogs from './TencentDocOperationLogs'
|
||||
|
||||
export default {
|
||||
name: 'TencentDocAutoWriteConfig',
|
||||
components: {
|
||||
TencentDocOperationLogs
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
type: Boolean,
|
||||
@@ -204,6 +218,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showOperationLogs: false,
|
||||
visible: false,
|
||||
config: {
|
||||
hasAccessToken: false,
|
||||
|
||||
304
src/views/system/jdorder/components/TencentDocOperationLogs.vue
Normal file
304
src/views/system/jdorder/components/TencentDocOperationLogs.vue
Normal file
@@ -0,0 +1,304 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="腾讯文档操作日志"
|
||||
:visible.sync="visible"
|
||||
width="90%"
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
<!-- 搜索条件 -->
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="80px">
|
||||
<el-form-item label="订单号">
|
||||
<el-input
|
||||
v-model="queryParams.orderNo"
|
||||
placeholder="请输入订单号"
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 200px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作类型">
|
||||
<el-select v-model="queryParams.operationType" placeholder="请选择" clearable size="small" style="width: 150px">
|
||||
<el-option label="批量同步" value="BATCH_SYNC" />
|
||||
<el-option label="单个写入" value="WRITE_SINGLE" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作状态">
|
||||
<el-select v-model="queryParams.operationStatus" placeholder="请选择" clearable size="small" style="width: 150px">
|
||||
<el-option label="成功" value="SUCCESS" />
|
||||
<el-option label="失败" value="FAILED" />
|
||||
<el-option label="跳过" value="SKIPPED" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 统计信息卡片 -->
|
||||
<el-row :gutter="20" style="margin-bottom: 20px">
|
||||
<el-col :span="6">
|
||||
<el-card shadow="hover">
|
||||
<div style="text-align: center">
|
||||
<div style="font-size: 24px; color: #67C23A; font-weight: bold">{{ statistics.success }}</div>
|
||||
<div style="color: #909399; margin-top: 8px">成功</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-card shadow="hover">
|
||||
<div style="text-align: center">
|
||||
<div style="font-size: 24px; color: #E6A23C; font-weight: bold">{{ statistics.skipped }}</div>
|
||||
<div style="color: #909399; margin-top: 8px">跳过</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-card shadow="hover">
|
||||
<div style="text-align: center">
|
||||
<div style="font-size: 24px; color: #F56C6C; font-weight: bold">{{ statistics.failed }}</div>
|
||||
<div style="color: #909399; margin-top: 8px">失败</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-card shadow="hover">
|
||||
<div style="text-align: center">
|
||||
<div style="font-size: 24px; color: #409EFF; font-weight: bold">{{ statistics.total }}</div>
|
||||
<div style="color: #909399; margin-top: 8px">总计</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 日志表格 -->
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="logList"
|
||||
border
|
||||
stripe
|
||||
style="width: 100%"
|
||||
max-height="500"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
|
||||
<el-table-column label="操作类型" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.operationType === 'BATCH_SYNC'" type="primary" size="small">批量同步</el-tag>
|
||||
<el-tag v-else-if="scope.row.operationType === 'WRITE_SINGLE'" type="success" size="small">单个写入</el-tag>
|
||||
<el-tag v-else size="small">{{ scope.row.operationType }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="订单号" prop="orderNo" width="180" />
|
||||
|
||||
<el-table-column label="目标行" prop="targetRow" width="80" align="center" />
|
||||
|
||||
<el-table-column label="物流链接" prop="logisticsLink" min-width="200" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<a v-if="scope.row.logisticsLink" :href="scope.row.logisticsLink" target="_blank" style="color: #409EFF">
|
||||
{{ scope.row.logisticsLink }}
|
||||
</a>
|
||||
<span v-else style="color: #C0C4CC">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作状态" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.operationStatus === 'SUCCESS'" type="success" size="small">成功</el-tag>
|
||||
<el-tag v-else-if="scope.row.operationStatus === 'FAILED'" type="danger" size="small">失败</el-tag>
|
||||
<el-tag v-else-if="scope.row.operationStatus === 'SKIPPED'" type="warning" size="small">跳过</el-tag>
|
||||
<el-tag v-else type="info" size="small">{{ scope.row.operationStatus }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="错误信息" prop="errorMessage" min-width="200" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.errorMessage" style="color: #F56C6C">{{ scope.row.errorMessage }}</span>
|
||||
<span v-else style="color: #C0C4CC">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作人" prop="operator" width="100" align="center" />
|
||||
|
||||
<el-table-column label="操作时间" prop="createTime" width="160" align="center" />
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<div style="text-align: right; margin-top: 20px">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="queryParams.pageNum"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="queryParams.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
>
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleClose">关闭</el-button>
|
||||
<el-button type="primary" icon="el-icon-refresh" @click="handleQuery">刷新</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getOperationLogs } from '@/api/jarvis/tendoc'
|
||||
|
||||
export default {
|
||||
name: 'TencentDocOperationLogs',
|
||||
props: {
|
||||
value: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
fileId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
sheetId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
logList: [],
|
||||
total: 0,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
fileId: '',
|
||||
sheetId: '',
|
||||
orderNo: '',
|
||||
operationType: '',
|
||||
operationStatus: ''
|
||||
},
|
||||
statistics: {
|
||||
success: 0,
|
||||
failed: 0,
|
||||
skipped: 0,
|
||||
total: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
visible: {
|
||||
get() {
|
||||
return this.value
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('input', val)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
if (val) {
|
||||
this.initData()
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
this.queryParams.fileId = this.fileId
|
||||
this.queryParams.sheetId = this.sheetId
|
||||
},
|
||||
|
||||
/** 查询日志列表 */
|
||||
async getList() {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await getOperationLogs(this.queryParams)
|
||||
if (res.code === 200) {
|
||||
this.logList = res.data || []
|
||||
this.total = this.logList.length
|
||||
this.calculateStatistics()
|
||||
} else {
|
||||
this.$message.error(res.msg || '查询失败')
|
||||
}
|
||||
} catch (e) {
|
||||
this.$message.error('查询失败: ' + (e.message || '未知错误'))
|
||||
console.error('查询操作日志失败', e)
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
|
||||
/** 计算统计数据 */
|
||||
calculateStatistics() {
|
||||
this.statistics = {
|
||||
success: 0,
|
||||
failed: 0,
|
||||
skipped: 0,
|
||||
total: this.logList.length
|
||||
}
|
||||
|
||||
this.logList.forEach(log => {
|
||||
if (log.operationStatus === 'SUCCESS') {
|
||||
this.statistics.success++
|
||||
} else if (log.operationStatus === 'FAILED') {
|
||||
this.statistics.failed++
|
||||
} else if (log.operationStatus === 'SKIPPED') {
|
||||
this.statistics.skipped++
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
fileId: this.fileId,
|
||||
sheetId: this.sheetId,
|
||||
orderNo: '',
|
||||
operationType: '',
|
||||
operationStatus: ''
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
|
||||
/** 分页 */
|
||||
handleSizeChange(val) {
|
||||
this.queryParams.pageSize = val
|
||||
this.getList()
|
||||
},
|
||||
|
||||
handleCurrentChange(val) {
|
||||
this.queryParams.pageNum = val
|
||||
this.getList()
|
||||
},
|
||||
|
||||
/** 关闭对话框 */
|
||||
handleClose() {
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-card {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.el-card:hover {
|
||||
transform: translateY(-2px);
|
||||
transition: all 0.3s;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user