diff --git a/src/api/dms/dmsBillsFaultInstance.js b/src/api/dms/dmsBillsFaultInstance.js index cc528b4..c30bcc7 100644 --- a/src/api/dms/dmsBillsFaultInstance.js +++ b/src/api/dms/dmsBillsFaultInstance.js @@ -98,3 +98,12 @@ export function getBillsFaultInstance4Repair(repairInstanceId) { method: 'get' }) } + +// 指定派工 +export function dispatchRepair(data) { + return request({ + url: '/dms/dmsBillsFaultInstance/dispatch', + method: 'post', + data: data + }) +} diff --git a/src/views/dms/dmsBillsFaultInstance/detail.vue b/src/views/dms/dmsBillsFaultInstance/detail.vue index 2ec106d..7364ae7 100644 --- a/src/views/dms/dmsBillsFaultInstance/detail.vue +++ b/src/views/dms/dmsBillsFaultInstance/detail.vue @@ -255,6 +255,7 @@ @@ -274,6 +275,21 @@ + + + + + + + + + + + + @@ -371,11 +387,13 @@ import { addDmsBillsFaultInstance, updateDmsBillsFaultInstance, startRepair, - completeRepair + completeRepair, + dispatchRepair } from '@/api/dms/dmsBillsFaultInstance' import { getDeviceLedgerList } from '@/api/base/deviceLedger' import { getKnowledgeRepairList } from '@/api/dms/knowledgeRepair' import { getToken } from '@/utils/auth' +import { selectUserList } from '@/api/system/user' export default { name: 'FaultRepairDetail', @@ -446,6 +464,11 @@ export default { ] }, + dispatchDialogVisible: false, + userOptions: [], + selectedUserId: null, + selectedUserName: '', + // 操作记录对话框 recordDialogVisible: false, recordDialogTitle: '', @@ -760,6 +783,42 @@ export default { }) }, + /** 打开派工对话框 */ + openDispatchDialog() { + if (!this.repairInstanceId) { + return this.$message.warning('未找到工单ID,无法派工') + } + this.selectedUserId = null + this.selectedUserName = '' + selectUserList({}).then(res => { + this.userOptions = (res && res.rows && res.rows.length ? res.rows : res.data) || [] + this.dispatchDialogVisible = true + }) + }, + + /** 选择人员 */ + onSelectUser(val) { + const u = (this.userOptions || []).find(x => x.userId === val) + this.selectedUserName = u ? (u.nickName || u.userName) : '' + }, + + /** 确认派工 */ + confirmDispatch() { + if (!this.selectedUserId) { + return this.$message.warning('请选择执行人') + } + const payload = { + repairInstanceId: this.repairInstanceId, + handleUserId: this.selectedUserId, + handleBy: this.selectedUserName + } + dispatchRepair(payload).then(() => { + this.$modal.msgSuccess('派工成功') + this.dispatchDialogVisible = false + this.loadData() + }) + }, + /** 提交表单 */ handleSubmit() { console.log('提交表单, faultForm:', this.faultForm) diff --git a/src/views/dms/dmsBillsFaultInstance/index.vue b/src/views/dms/dmsBillsFaultInstance/index.vue index 84509a1..361291b 100644 --- a/src/views/dms/dmsBillsFaultInstance/index.vue +++ b/src/views/dms/dmsBillsFaultInstance/index.vue @@ -101,6 +101,13 @@ @click="handleEditDetail(scope.row)" v-hasPermi="['dms:dmsBillsFaultInstance:edit']" >编辑 + 指定派工 取 消 + + + + + + + + + + + @@ -377,8 +398,10 @@ import { handleFaultExport, startRepair, completeRepair, + dispatchRepair, getBillsFaultInstance4Repair } from "@/api/dms/dmsBillsFaultInstance"; +import { selectUserList } from '@/api/system/user' import { listDmsRepair } from '@/api/dms/dmsRepair' import { listDmsRepairInstance } from '@/api/dms/dmsRepairInstance' import { listPoint,listSelectInspection } from '@/api/dms/dmsBillsInstance' @@ -446,6 +469,12 @@ export default { title: "", // 是否显示弹出层 open: false, + // 指定派工对话框 + dispatchDialogVisible: false, + userOptions: [], + selectedUserId: null, + selectedUserName: '', + dispatchRow: null, // 查询参数 queryParams: { pageNum: 1, @@ -648,6 +677,37 @@ export default { this.getList() }) }, + handleDispatch(row) { + this.dispatchRow = row + this.selectedUserId = null + this.selectedUserName = '' + selectUserList({}).then(res => { + this.userOptions = (res && res.rows && res.rows.length ? res.rows : res.data) || [] + this.dispatchDialogVisible = true + }) + }, + onSelectUser(val) { + const u = (this.userOptions || []).find(x => x.userId === val) + this.selectedUserName = u ? (u.nickName || u.userName) : '' + }, + confirmDispatch() { + if (!this.dispatchRow || !this.dispatchRow.repairInstanceId) { + return this.$message.warning('未找到工单ID,无法派工') + } + if (!this.selectedUserId) { + return this.$message.warning('请选择执行人') + } + const payload = { + repairInstanceId: this.dispatchRow.repairInstanceId, + handleUserId: this.selectedUserId, + handleBy: this.selectedUserName + } + dispatchRepair(payload).then(() => { + this.$modal.msgSuccess('派工成功') + this.dispatchDialogVisible = false + this.getList() + }) + }, /** 完成维修(列表快捷) */ handleCompleteRepair(row) { getBillsFaultInstance4Repair(row.repairInstanceId).then(res => {