refactor(task-management): 重构工单管理功能

- 更新了工作台页面的工单列表和详情展示
- 重构了工单关闭和删除的逻辑
-优化了工单详情弹窗的展示内容
- 调整了 API 接口的参数传递方式
This commit is contained in:
dj
2024-11-23 12:19:04 +08:00
parent 2856ce09dd
commit 226ff55ddf
8 changed files with 127 additions and 118 deletions

View File

@@ -1,14 +1,14 @@
<template>
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
<fvTable ref="tableIns" :tableConfig="tableConfig" :data="mockData" @headBtnClick="headBtnClick"></fvTable>
<WorkDialog ref="workDialogRef" :rowData="rowData" />
<WorkDialog ref="workDialogRef" :rowData="rowData"/>
</template>
<script setup lang="jsx">
import { reactive, shallowRef } from 'vue';
import {reactive, shallowRef} from 'vue';
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
import WorkDialog from '../components/WorkDialog.vue';
import { orderdDetele, orderdClose } from "@/api/order/order.js"
import {orderdDetele, orderdClose} from "@/api/order/order.js"
const rowData = ref()
const workDialogRef = ref()
@@ -150,9 +150,9 @@ const tableConfig = reactive({
label: '工单状态',
align: 'center',
showOverflowTooltip: false,
currentRender: ({ row, index }) => {
currentRender: ({row, index}) => {
if (row.orderState !== null) {
return (<Tag dictType={'work_order_status'} value={row.orderState} />)
return (<Tag dictType={'work_order_status'} value={row.orderState}/>)
} else {
return '--'
}
@@ -164,9 +164,9 @@ const tableConfig = reactive({
align: 'center',
width: 150,
showOverflowTooltip: false,
currentRender: ({ row, index }) => {
currentRender: ({row, index}) => {
if (row.callState !== null) {
return (<Tag dictType={'call_status'} value={row.callState} />)
return (<Tag dictType={'call_status'} value={row.callState}/>)
} else {
return '--'
}
@@ -176,7 +176,7 @@ const tableConfig = reactive({
prop: 'operationUser',
label: '处理人',
align: 'center',
currentRender: ({ row, index }) => {
currentRender: ({row, index}) => {
if (row.operationUser) {
return row.operationUser
} else {
@@ -220,28 +220,28 @@ const tableConfig = reactive({
fixed: 'right',
width: 150,
showOverflowTooltip: false,
currentRender: ({ row, index }) => {
currentRender: ({row, index}) => {
// console.log(row);
let btn = []
btn.push({ label: '详情', prem: auths.detail, func: () => handleDetail(row), type: 'primary' })
btn.push({ label: '关单', prem: auths.close, func: () => handleClose(row), type: 'primary' })
btn.push({ label: '删除', prem: auths.delete, func: () => handleDelete(row), type: 'danger'})
btn.push({label: '详情', prem: auths.detail, func: () => handleDetail(row), type: 'primary'})
btn.push({label: '关单', prem: auths.close, func: () => handleClose(row), type: 'primary'})
btn.push({label: '删除', prem: auths.delete, func: () => handleDelete(row), type: 'danger'})
return (
<div style={{ width: '100%' }}>
{
btn.map(item => (
<el-button
type={item.type}
v-perm={item.prem}
onClick={() => item.func()}
link
>
{item.label}
</el-button>
))
}
</div>
<div style={{width: '100%'}}>
{
btn.map(item => (
<el-button
type={item.type}
v-perm={item.prem}
onClick={() => item.func()}
link
>
{item.label}
</el-button>
))
}
</div>
)
}
}
@@ -253,7 +253,7 @@ const tableConfig = reactive({
]
})
const search = (val) => {
let obj = { ...val }
let obj = {...val}
if (obj.dateValue) {
obj.startTime = obj.dateValue[0]
obj.endTime = obj.dateValue[1]
@@ -282,30 +282,35 @@ const handleDetail = (row) => {
const handleClose = async (row) => {
if (row.orderState !== '2') {
ElMessageBox.confirm(
'确定要关单吗?',
'温馨提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(async () => {
const info = await orderdClose(row.orderNumber)
// console.log(info);
if (info.code === 1000) {
tableIns.value.refresh()
ElMessage({
message: '关闭成功',
type: 'success',
})
} else {
ElMessage({
message: info.msg,
type: 'warning',
})
'确定要关单吗?',
'温馨提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
})
)
.then(async () => {
const info = await orderdClose(
{
orderNumber: row.orderNumber,
alarmObject: row.alarmObject,
alarmUnit: row.alarmUnit
})
// console.log(info);
if (info.code === 1000) {
tableIns.value.refresh()
ElMessage({
message: '关闭成功',
type: 'success',
})
} else {
ElMessage({
message: info.msg,
type: 'warning',
})
}
})
} else {
ElMessageBox.alert('此工单已被关闭!', '温馨提示', {
@@ -321,30 +326,30 @@ const handleClose = async (row) => {
const handleDelete = async (row) => {
ElMessageBox.confirm(
'确定要删除吗?',
'温馨提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(async () => {
const info = await orderdDetele(row.orderNumber)
console.log(info);
if (info.code === 1000) {
tableIns.value.refresh()
ElMessage({
message: '删除成功',
type: 'success',
})
} else {
ElMessage({
message: info.msg,
type: 'warning',
})
'确定要删除吗?',
'温馨提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
})
)
.then(async () => {
const info = await orderdDetele(row.orderNumber)
console.log(info);
if (info.code === 1000) {
tableIns.value.refresh()
ElMessage({
message: '删除成功',
type: 'success',
})
} else {
ElMessage({
message: info.msg,
type: 'warning',
})
}
})
}
</script>