20250526-增加重新派单功能- pc端管理员重新派单功能无法使用.pc端需要支持管理员重新派单,用户使用pc端频率更高.

This commit is contained in:
luoyu 2025-05-26 12:08:27 +08:00
parent 7fc28e08a7
commit 0d8de44e36
3 changed files with 218 additions and 23 deletions

View File

@ -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',

View File

@ -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: {}

View 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>