feat(dms): 添加指定派工功能

- 在故障工单详情页添加指定派工按钮及对话框
- 实现选择执行人并提交派工逻辑
- 新增调用指定派工接口 /dms/dmsBillsFaultInstance/dispatch
- 在工单列表页增加指定派工操作入口
- 引入用户列表接口用于派工人员选择
- 添加相关状态判断和权限控制
master
zangch@mesnac.com 1 month ago
parent 71f0635be1
commit ab81a379c4

@ -98,3 +98,12 @@ export function getBillsFaultInstance4Repair(repairInstanceId) {
method: 'get'
})
}
// 指定派工
export function dispatchRepair(data) {
return request({
url: '/dms/dmsBillsFaultInstance/dispatch',
method: 'post',
data: data
})
}

@ -255,6 +255,7 @@
<div class="footer-buttons">
<el-button @click="goBack"> </el-button>
<el-button type="primary" @click="handleSubmit" v-if="!isView"> </el-button>
<el-button type="primary" @click="openDispatchDialog" v-if="!isView && repairInstanceId && billsStatus === '0'"></el-button>
<el-button type="warning" @click="onStartRepair" v-if="!isView && repairInstanceId && billsStatus === '0'"></el-button>
<el-button type="success" @click="onCompleteRepair" v-if="!isView && repairInstanceId && billsStatus === '1'"></el-button>
</div>
@ -274,6 +275,21 @@
</div>
</el-dialog>
<el-dialog title="指定派工" :visible.sync="dispatchDialogVisible" width="40%" append-to-body>
<el-form label-width="100px">
<el-form-item label="执行人">
<el-select v-model="selectedUserId" placeholder="请选择执行人" filterable style="width: 100%" @change="onSelectUser">
<el-option v-for="u in userOptions" :key="u.userId" :label="u.nickName || u.userName" :value="u.userId" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dispatchDialogVisible = false"> </el-button>
<el-button type="primary" @click="confirmDispatch"> </el-button>
</div>
</el-dialog>
<!-- 开始维修对话框 -->
<el-dialog title="开始维修" :visible.sync="startRepairDialogVisible" width="50%" append-to-body>
<el-form ref="startRepairForm" :model="startRepairForm" :rules="startRepairRules" label-width="100px">
@ -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)

@ -101,6 +101,13 @@
@click="handleEditDetail(scope.row)"
v-hasPermi="['dms:dmsBillsFaultInstance:edit']"
>编辑</el-button>
<el-button
v-if="scope.row.billsStatus === '0'"
size="mini"
type="text"
@click="handleDispatch(scope.row)"
v-hasPermi="['dms:dmsBillsFaultInstance:edit']"
>指定派工</el-button>
<el-button
v-if="scope.row.billsStatus === '0'"
size="mini"
@ -364,6 +371,20 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog title="指定派工" :visible.sync="dispatchDialogVisible" width="400px" append-to-body>
<el-form label-width="96px">
<el-form-item label="执行人">
<el-select v-model="selectedUserId" placeholder="请选择执行人" filterable style="width: 100%" @change="onSelectUser">
<el-option v-for="u in userOptions" :key="u.userId" :label="u.nickName || u.userName" :value="u.userId" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dispatchDialogVisible = false"> </el-button>
<el-button type="primary" @click="confirmDispatch"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -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 => {

Loading…
Cancel
Save