From 3093c19246f8147998312630a644e0ace1795dea Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Fri, 21 Nov 2025 18:12:29 +0800
Subject: [PATCH] feat:更换字段
---
src/views/tickets/ticket.vue | 70 +++++++++++++++--------------------
1 files changed, 30 insertions(+), 40 deletions(-)
diff --git a/src/views/tickets/ticket.vue b/src/views/tickets/ticket.vue
index db67145..1c03114 100644
--- a/src/views/tickets/ticket.vue
+++ b/src/views/tickets/ticket.vue
@@ -154,17 +154,17 @@
>
<el-table-column type="selection" width="55" v-if="permissionList.reviewBtn || permissionList.exportBtn" />
<el-table-column type="index" label="序号" width="60" />
- <el-table-column prop="orderNumber" label="工单编号" width="170">
+ <el-table-column prop="event_num" label="工单编号" width="170">
<template #default="{ row }">
- <el-tooltip-copy :content="row.orderNumber" :showCopyText="true" textAlign="left">
- {{ row.orderNumber }}
+ <el-tooltip-copy :content="row.event_num" :showCopyText="true" textAlign="left">
+ {{ row.event_num }}
</el-tooltip-copy>
</template>
</el-table-column>
- <el-table-column prop="orderName" label="工单名称" width="150" show-overflow-tooltip>
+ <el-table-column prop="event_name" label="工单名称" width="150" show-overflow-tooltip>
<template #default="{ row }">
- <el-tooltip-copy :content="row.orderName" :showCopyText="true" textAlign="left">
- {{ row.orderName }}
+ <el-tooltip-copy :content="row.event_name" :showCopyText="true" textAlign="left">
+ {{ row.event_name }}
</el-tooltip-copy>
</template>
</el-table-column>
@@ -173,7 +173,7 @@
<el-table-column prop="startTime" label="发起任务时间" width="160" show-overflow-tooltip />
- <el-table-column prop="aiType" label="关联算法" show-overflow-tooltip />
+ <el-table-column prop="ai_types" label="关联算法" show-overflow-tooltip />
<el-table-column prop="type" label="工单类型" width="110" show-overflow-tooltip>
<template #default="{ row }">
@@ -665,7 +665,9 @@
currentDetail.value.processingDetail = currentDetail.value.processing_details
currentDetail.value.showQR = false
currentDetail.value.latAndLon = _.round(currentDetail.value.location[0], 6) + ',' + _.round(currentDetail.value.location[1], 6)
- getStepInfoData(currentDetail.value.orderNumber)
+ console.log('currentDetail.value',currentDetail.value);
+
+ getStepInfoData(currentDetail.value.orderNumber)
}
// 更新当前详情数据
@@ -743,7 +745,7 @@
console.error('加载下拉框数据失败:', error)
}
}
-// 获取表格数据
+// 获取表格数据
async function fetchTableData() {
if (isFetching.value) return
isFetching.value = true
@@ -786,12 +788,13 @@
const longitude = Number(item.longitude) || 0
const latitude = Number(item.latitude) || 0
return {
+ ...item,
id: item.id,
- orderNumber: item.event_num,
- orderName: item.event_name,
+ // orderNumber: item.event_num,
+ // orderName: item.event_name,
department: departments.value.find(d => d.value === item.dept_id)?.label || item.dept_name,
startTime: item.job_create_time || '/',
- aiType: item.ai_types,
+ // aiType: item.ai_types,
content: item.content,
type: item.work_order_type_dict_key,
keyData: !isNaN(longitude) && !isNaN(latitude)
@@ -814,6 +817,7 @@
}
})
+console.log('tableData.value',tableData.value);
page.total = total || 0
if (isShowInfo.value) {
@@ -835,9 +839,7 @@
algorithms2.value = []
return
}
-
const matchedCategory = allAlgorithms.value.find(category => category.dict_key === typeValue)
-
if (!matchedCategory || !matchedCategory.algorithms || matchedCategory.algorithms.length === 0) {
algorithms2.value = []
return
@@ -880,7 +882,7 @@
}
return colorMap[String(status)] || ''
}
-
+// 获取tab数据
async function fetchTabCounts() {
const statusListVal = statusList.value;
const params = {
@@ -907,7 +909,7 @@
})
}
}
-
+// tab切换
function handleTabChange(tab) {
activeTab.value = tab.props?.name || tab.name
@@ -929,6 +931,7 @@
fetchTableData()
fetchTabCounts()
}
+// 清空
function handleReset() {
dictKey.value = ''
Object.assign(filters, {
@@ -948,26 +951,22 @@
function handleKeyWords() {
router.replace({})
}
-
// 分页
async function handleCurrentChange(val) {
page.currentPage = val
await nextTick()
await fetchTableData()
}
-
async function sizeChange(val) {
page.pageSize = val
page.currentPage = 1
await nextTick()
await fetchTableData()
}
-
function handleAdd() {
editFormData.value = null
dialogVisible.value = true
}
-
async function getStepInfoData(val) {
try {
const orderNum = val
@@ -1000,7 +999,6 @@
}
return true
} catch (error) {
- console.error('获取步骤信息失败:', error)
if (activeTab.value === 'myTickets') {
const statusArr = workType.value === 1 ? ['3', '4'] : fixedStatuses.value
stepInfos.value = statusArr.map(status => ({
@@ -1016,6 +1014,8 @@
}
async function handleViewDetail(row) {
+console.log('row',row);
+
currentIndex.value = tableData.value.findIndex(item => item.id === row.id)
workType.value = row.work_type !== undefined ? Number(row.work_type) : 0
const detailData = {
@@ -1027,7 +1027,7 @@
job_name: row.job_name || '',
}
- await getStepInfoData(row.orderNumber)
+ await getStepInfoData(row.event_num)
currentDetail.value.status = row.status
currentDetail.value = {
@@ -1035,8 +1035,6 @@
showQR: false,
latAndLon: _.round(detailData.location[0], 6) + ',' + _.round(detailData.location[1], 6),
}
-console.log('currentDetail.value',currentDetail.value);
-
detailVisible.value = true
handleTypeChange(currentDetail.value.type)
}
@@ -1092,7 +1090,6 @@
]
export_json_to_excel(headers, exportData, '工单数据')
- console.log('数据导出成功')
} catch (error) {
console.error('导出失败:', error)
} finally {
@@ -1105,11 +1102,11 @@
const latitude = Number(item.latitude) || Number(item.location?.[1]) || 0
return {
- 工单编号: item.orderNumber || item.event_num || '',
- 工单名称: item.orderName || item.event_name || '',
+ 工单编号: item.event_num || '',
+ 工单名称: item.event_name || '',
所属部门: item.department || item.dept_name || '',
发起时间: item.startTime || item.create_time || '',
- 关联算法: item.aiType || item.ai_types || '',
+ 关联算法: item.ai_types || '',
工单内容: item.address || item.content || '',
工单类型: types.value.find(t => t.value === (item.type || item.work_order_type_dict_key))?.label || '',
经纬度: !isNaN(longitude) && !isNaN(latitude)
@@ -1153,7 +1150,6 @@
// 删除方法
function handleDelete(row) {
- console.log('删除工单:', row)
}
// 添加选择变化处理方法
@@ -1217,18 +1213,15 @@
}
// 在Vue 3中需要使用ElMessageBox.confirm
-
const data = {
id: currentItem.id,
status: currentItem.status,
isPass: 0,
- eventNum: currentItem.orderNumber,
+ eventNum: currentItem.event_num,
}
const response = await flowEvent(data)
if (response.data.code === 0) {
- console.log('工单审核通过')
-
const newSelections = [...selections.value]
newSelections.splice(currentImageIndex.value - 1, 1)
@@ -1280,14 +1273,12 @@
id: currentItem.id,
status: currentItem.status,
isPass: 1,
- eventNum: currentItem.orderNumber,
- eventName: currentItem.orderName,
+ eventNum: currentItem.event_num,
+ eventName: currentItem.event_name,
}
const response = await flowEvent(data)
if (response.data.code === 0) {
- console.log('工单审核不通过')
-
const newSelections = [...selections.value]
newSelections.splice(currentImageIndex.value - 1, 1)
selections.value = newSelections
@@ -1394,11 +1385,11 @@
// 导出工单报表
function exportTheTick(row) {
const params = {
- num: row.orderNumber
+ num: row.event_num
}
exportTheTicket(params).then(res => {
const elink = document.createElement('a')
- elink.download = row.orderName + '.docx'
+ elink.download = row.event_name + '.docx'
elink.style.display = 'none'
const blob = new Blob([res.data])
elink.href = URL.createObjectURL(blob)
@@ -1406,7 +1397,6 @@
elink.click()
document.body.removeChild(elink)
})
- console.log('数据导出成功')
}
// 生命周期
--
Gitblit v1.9.3