mirror of
https://gitee.com/elegant_wings/dbd-meeting-html.git
synced 2025-06-21 06:49:37 +08:00
20250526-增加重新派单功能- pc端管理员重新派单功能无法使用.pc端需要支持管理员重新派单,用户使用pc端频率更高.
This commit is contained in:
parent
7fc28e08a7
commit
0d8de44e36
@ -45,6 +45,22 @@ export function review(parameter, uniqueArr) {
|
||||
})
|
||||
}
|
||||
|
||||
// 重新派单处理流程
|
||||
export function handleFlow(repair, content, operate) {
|
||||
return axios({
|
||||
url: api.repair + '/flow/handle',
|
||||
method: 'post',
|
||||
data: {
|
||||
'repair': repair,
|
||||
'content': content,
|
||||
'operate': operate
|
||||
},
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function complete(parameter) {
|
||||
return axios({
|
||||
url: api.repair + '/complete',
|
||||
|
@ -123,15 +123,14 @@
|
||||
</span>
|
||||
<span slot='action' slot-scope='text, record'>
|
||||
<a v-if='editEnabel' @click='handleView(record.id)'>详情</a>
|
||||
<!-- <a-divider v-if='!isShowModel' type='vertical' />-->
|
||||
<!-- <a v-if='editEnabel && !isShowModel' @click='handleEdit(record)'>编辑</a>-->
|
||||
<a-divider v-if='!isShowModel' type='vertical' />
|
||||
<a v-if='record.status == 3' @click='handleAgain(record.id)'>重新派单</a>
|
||||
<a-divider v-if='record.status == 3' type='vertical' />
|
||||
<a type='danger' v-if='!isShowModel' @click='delByIds(record.id)'>删除</a>
|
||||
<!-- <a-divider v-if='!isShowModel' type='vertical' />-->
|
||||
<!-- <a type='danger' v-if='!isShowModel' @click='delByIds(selectedRowKeys)'>批量删除</a>-->
|
||||
</span>
|
||||
</s-table>
|
||||
<repair-modal ref='modal' @success='handleOk' />
|
||||
<again-modal ref='againModal' @success='handleOk' />
|
||||
|
||||
<a-modal v-model='visible' title='导入工单'>
|
||||
<div style='display: flex'>
|
||||
@ -153,6 +152,7 @@ import { STable } from '@/components'
|
||||
import { getRepairList, complete, delRepair } from '@/api/admin/repair'
|
||||
import { oneWorkerList, oneFloorList, oneFloorCreateList } from '@/api/admin/repair/repairStats'
|
||||
import RepairModal from './modules/RepairModal.vue'
|
||||
import AgainModal from './modules/AgainModal.vue'
|
||||
import { checkPermission } from '@/utils/permissions'
|
||||
import { getRepairDeviceList } from '@/api/admin/repair/repairDevice'
|
||||
import { getRepairTypeList } from '@/api/admin/repair/repairDeviceType'
|
||||
@ -166,7 +166,8 @@ export default {
|
||||
name: 'TableList',
|
||||
components: {
|
||||
STable,
|
||||
RepairModal
|
||||
RepairModal,
|
||||
AgainModal
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -622,30 +623,30 @@ export default {
|
||||
this.dateRange[1].format('YYYY-MM-DD')
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
const filterConditions = {
|
||||
queryParam: JSON.parse(JSON.stringify(this.queryParam)), // 深拷贝查询参数
|
||||
dateRange: formattedDateRange,
|
||||
typeId: this.queryParam.typeId || '',
|
||||
deviceId: this.queryParam.deviceId || ''
|
||||
}
|
||||
|
||||
|
||||
// 保存到localStorage
|
||||
localStorage.setItem('repairListFilterConditions', JSON.stringify(filterConditions))
|
||||
},
|
||||
|
||||
|
||||
// 从localStorage恢复筛选条件
|
||||
restoreFilterConditions() {
|
||||
const savedConditions = localStorage.getItem('repairListFilterConditions')
|
||||
if (savedConditions) {
|
||||
try {
|
||||
const conditions = JSON.parse(savedConditions)
|
||||
|
||||
|
||||
// 恢复查询参数
|
||||
if (conditions.queryParam) {
|
||||
this.queryParam = conditions.queryParam
|
||||
}
|
||||
|
||||
|
||||
// 恢复日期范围
|
||||
if (conditions.dateRange && conditions.dateRange.length === 2) {
|
||||
this.dateRange = [
|
||||
@ -655,12 +656,12 @@ export default {
|
||||
this.queryParam.startTime = conditions.dateRange[0]
|
||||
this.queryParam.endTime = conditions.dateRange[1]
|
||||
}
|
||||
|
||||
|
||||
// 恢复设备类型及子类
|
||||
if (conditions.typeId) {
|
||||
// 先加载设备类型
|
||||
this.selectDevice(conditions.typeId)
|
||||
|
||||
|
||||
// 确保设备子类被正确设置
|
||||
if (conditions.deviceId) {
|
||||
this.$nextTick(() => {
|
||||
@ -668,7 +669,7 @@ export default {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 刷新表格
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.table) {
|
||||
@ -694,15 +695,15 @@ export default {
|
||||
// 检查其他参数是否有值
|
||||
return this.queryParam[key] !== '' && this.queryParam[key] !== null && this.queryParam[key] !== undefined
|
||||
})
|
||||
|
||||
|
||||
// 检查日期范围
|
||||
const hasDateRange = this.dateRange && this.dateRange.length === 2
|
||||
|
||||
|
||||
if (!hasFilter && !hasDateRange) {
|
||||
this.$message.info('当前没有设置筛选条件,无需保存')
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// 保存筛选条件
|
||||
this.saveFilterConditions()
|
||||
this.$message.success('筛选条件已保存,下次访问将自动应用')
|
||||
@ -716,7 +717,7 @@ export default {
|
||||
try {
|
||||
// 清除localStorage中保存的筛选条件
|
||||
localStorage.removeItem('repairListFilterConditions')
|
||||
|
||||
|
||||
// 重置查询参数
|
||||
this.queryParam = {
|
||||
'type': 'all',
|
||||
@ -733,17 +734,17 @@ export default {
|
||||
'remark': '',
|
||||
'name': ''
|
||||
}
|
||||
|
||||
|
||||
// 重置时间范围
|
||||
this.dateRange = []
|
||||
|
||||
|
||||
// 刷新列表数据
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.table) {
|
||||
this.$refs.table.refresh(true)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
this.$message.success('筛选条件已清除,列表已重置')
|
||||
} catch (e) {
|
||||
console.error('清除筛选条件失败', e)
|
||||
@ -763,10 +764,10 @@ export default {
|
||||
// 检查其他参数是否有值
|
||||
return this.queryParam[key] !== '' && this.queryParam[key] !== null && this.queryParam[key] !== undefined
|
||||
})
|
||||
|
||||
|
||||
// 检查日期范围
|
||||
const hasDateRange = this.dateRange && this.dateRange.length === 2
|
||||
|
||||
|
||||
if (hasFilter || hasDateRange) {
|
||||
// 保存筛选条件
|
||||
this.saveFilterConditions()
|
||||
@ -775,9 +776,12 @@ export default {
|
||||
} catch (e) {
|
||||
console.error('自动保存筛选条件失败', e)
|
||||
}
|
||||
|
||||
|
||||
// 然后刷新表格
|
||||
this.$refs.table.refresh(true)
|
||||
},
|
||||
handleAgain(repairId) {
|
||||
this.$refs.againModal.show(repairId)
|
||||
}
|
||||
},
|
||||
watch: {}
|
||||
|
175
src/views/admin/modules/AgainModal.vue
Normal file
175
src/views/admin/modules/AgainModal.vue
Normal file
@ -0,0 +1,175 @@
|
||||
<template>
|
||||
<a-modal
|
||||
title='重新派单'
|
||||
style='top: 20px;'
|
||||
:width='800'
|
||||
v-model='visible'
|
||||
:confirmLoading='confirmLoading'
|
||||
@ok='handleSubmit'
|
||||
>
|
||||
<a-form :form='form'>
|
||||
<a-card :bordered='true'>
|
||||
<a-row>
|
||||
<a-col :span='24'>
|
||||
<div class="repair-info">
|
||||
<p>工单号:{{ repairInfo.sn }}</p>
|
||||
<p>当前状态:{{ statusFilter(repairInfo.status) }}</p>
|
||||
<p>当前故障类型:{{ repairInfo.typeName + '/' + repairInfo.deviceName }}</p>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-divider />
|
||||
|
||||
<a-row>
|
||||
<a-col :span='12'>
|
||||
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='故障类型'>
|
||||
<a-select v-decorator="['typeId', {rules: [{ required: true, message: '请选择故障类型' }]}]"
|
||||
@change='selectDevice'>
|
||||
<a-select-option v-for='item in typeList' :key='item.id' :value='item.id'>{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span='12'>
|
||||
<a-form-item :labelCol='labelCol' :wrapperCol='wrapperCol' label='故障子类'>
|
||||
<a-select v-decorator="['deviceId', {rules: [{ required: true, message: '请选择故障子类' }]}]"
|
||||
@change='getDeviceName'>
|
||||
<a-select-option v-for='item in deviceList' :key='item.id' :value='item.id'>{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getRepair, handleFlow } from '@/api/admin/repair'
|
||||
import { getRepairTypeList } from '@/api/admin/repair/repairDeviceType'
|
||||
import { getRepairDeviceList } from '@/api/admin/repair/repairDevice'
|
||||
|
||||
export default {
|
||||
name: 'AgainModal',
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
repairId: null,
|
||||
repairInfo: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 7 }
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 17 }
|
||||
},
|
||||
form: this.$form.createForm(this),
|
||||
typeList: [],
|
||||
deviceList: [],
|
||||
typeName: '',
|
||||
deviceName: '',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.selectType()
|
||||
},
|
||||
methods: {
|
||||
// 获取故障类型列表
|
||||
selectType() {
|
||||
getRepairTypeList().then(res => {
|
||||
this.typeList = res.rows
|
||||
})
|
||||
},
|
||||
|
||||
// 根据故障类型获取设备列表
|
||||
selectDevice(typeId) {
|
||||
const type = this.typeList.find(item => item.id === typeId)
|
||||
this.typeName = type ? type.name : ''
|
||||
|
||||
getRepairDeviceList({ typeId }).then(res => {
|
||||
this.deviceList = res.rows
|
||||
})
|
||||
},
|
||||
|
||||
// 获取设备名称
|
||||
getDeviceName(deviceId) {
|
||||
const device = this.deviceList.find(item => item.id === deviceId)
|
||||
this.deviceName = device ? device.name : ''
|
||||
},
|
||||
|
||||
// 打开模态框并加载工单详情
|
||||
show(repairId) {
|
||||
this.repairId = repairId
|
||||
this.visible = true
|
||||
|
||||
// 获取工单详情
|
||||
getRepair({ id: repairId }).then(res => {
|
||||
this.repairInfo = res.repair || {}
|
||||
|
||||
// 重置表单
|
||||
this.form.resetFields()
|
||||
})
|
||||
},
|
||||
|
||||
// 提交重新派单
|
||||
handleSubmit() {
|
||||
this.form.validateFields((err, values) => {
|
||||
if (err) return
|
||||
|
||||
this.confirmLoading = true
|
||||
|
||||
// 构建重新派单的参数
|
||||
const repair = {
|
||||
id: this.repairId,
|
||||
typeId: values.typeId,
|
||||
typeName: this.typeName,
|
||||
deviceId: values.deviceId,
|
||||
deviceName: this.deviceName
|
||||
}
|
||||
|
||||
// 调用重新派单API
|
||||
handleFlow(repair, '重新指派设备类型', 'NEXT').then(res => {
|
||||
this.confirmLoading = false
|
||||
if (res.code === 0) {
|
||||
this.$message.success('重新派单成功')
|
||||
this.visible = false
|
||||
this.$emit('success')
|
||||
} else {
|
||||
this.$message.error(res.msg || '操作失败')
|
||||
}
|
||||
}).catch(() => {
|
||||
this.confirmLoading = false
|
||||
this.$message.error('系统错误,请稍后重试')
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 状态过滤
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
'1': '待派单',
|
||||
'3': '重新派单',
|
||||
'5': '已派单',
|
||||
'7': '处理中',
|
||||
'9': '待评价',
|
||||
'11': '无效申请',
|
||||
'13': '已评价'
|
||||
}
|
||||
return statusMap[status] || '未知状态'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.repair-info {
|
||||
padding: 10px 0;
|
||||
}
|
||||
.repair-info p {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user