维修工接单/维修班组长重新指派

This commit is contained in:
xiaofajia 2024-10-14 17:25:49 +08:00
parent 7b16f2cff4
commit 458cb418b8
10 changed files with 428 additions and 84 deletions

View File

@ -1,53 +1,69 @@
import request from '@/utils/request'
// 创建维修工人
export function createWorker(data) {
return request({
url: '/repair/worker/create',
method: 'post',
data: data
})
}
// 更新维修工人
export function updateWorker(data) {
return request({
url: '/repair/worker/update',
method: 'put',
data: data
})
}
// 删除维修工人
export function deleteWorker(id) {
return request({
url: '/repair/worker/delete?id=' + id,
method: 'delete'
})
}
// 获得维修工人
export function getWorker(id) {
return request({
url: '/repair/worker/get?id=' + id,
method: 'get'
})
}
// 获得维修工人分页
export function getWorkerPage(params) {
return request({
url: '/repair/worker/page',
method: 'get',
params
})
}
// 导出维修工人 Excel
export function exportWorkerExcel(params) {
return request({
url: '/repair/worker/export-excel',
method: 'get',
params,
responseType: 'blob'
})
}
import request from '@/utils/request'
// 创建维修工人
export function createWorker(data) {
return request({
url: '/repair/worker/create',
method: 'post',
data: data
})
}
// 更新维修工人
export function updateWorker(data) {
return request({
url: '/repair/worker/update',
method: 'put',
data: data
})
}
// 删除维修工人
export function deleteWorker(id) {
return request({
url: '/repair/worker/delete?id=' + id,
method: 'delete'
})
}
// 获得维修工人
export function getWorker(id) {
return request({
url: '/repair/worker/get?id=' + id,
method: 'get'
})
}
// 获得维修工人分页
export function getWorkerPage(params) {
return request({
url: '/repair/worker/page',
method: 'get',
params
})
}
// 导出维修工人 Excel
export function exportWorkerExcel(params) {
return request({
url: '/repair/worker/export-excel',
method: 'get',
params,
responseType: 'blob'
})
}
// 通过工单ID查到工单ID中所选择的员工信息
export function listByTicketId(id){
return request({
url: '/repair/worker/listByTicketId?ticketId=' + id,
method: 'get'
})
}
// 通过班组长的id查该班组的员工
export function listByLeads(){
return request({
url: '/repair/worker/listByLeadsId',
method: 'get'
})
}

View File

@ -72,3 +72,28 @@ export function getPageType(params){
params
})
}
// 判断登录用户的角色,针对维修工单中的四个角色
export function getUserRole(){
return request({
url: preUrl + "/userRole",
method: "get"
})
}
// 接单
export function updateTake(id){
return request({
url: preUrl + "/take?id=" + id,
method: "get",
})
}
// 指派员工,通知施工
export function updateRepair(data){
return request({
url: preUrl + "/notify",
method: "post",
data
})
}

View File

@ -212,6 +212,8 @@ export const DICT_TYPE = {
REPAIR_NOTICE_SERVER: 'weixiu',
//工种(维修项目类型)
REPAIR_WORK_TYPE: 'repair_work_type',
// 维修工单进行状态
REPAIR_TICKETS_WORK_STATUS: 'repair_tickets_work_status',
// ---------会员相关---------member_coupon_typemember_coupon_out_rulemember_carmember_active
//卡券类型

View File

@ -1,5 +1,6 @@
<template>
<el-select :loading="selectLoading" v-model="staffSelected" clearable filterable :filter-method="changeQuery" @blur="$emit('input-blur', $event)">
<el-select :loading="selectLoading" v-model="staffSelected" clearable filterable :filter-method="changeQuery"
@blur="$emit('input-blur', $event)">
<el-option v-for="staff in staffList" :key="staff.id" :label="staff.name + ' ' + staff.tel" :value="staff.id"/>
</el-select>
</template>
@ -14,7 +15,7 @@ export default {
value: {
type: Object,
},
isGet:{
isGet: {
type: String,
default: '',
required: false
@ -32,7 +33,9 @@ export default {
watch: {
staffSelected(val) {
const staff = this.staffList.find(item => item.id === val);
this.$emit("input", staff);
if (staff) {
this.$emit("input", staff);
}
},
value(newVal) {
if (newVal) {
@ -52,12 +55,11 @@ export default {
if (!this.isGet) return;
const res = await getStaffList(this.query)
this.staffList = res.data
this.hasRequest = true
} finally {
this.selectLoading = false
}
},
changeQuery(val){
changeQuery(val) {
this.query = val
this.listStaff()
}

View File

@ -185,7 +185,6 @@ export default {
watch: {
list: {
handler(val) {
// console.log(val)
this.$emit("tableData", val)
const coupons = val.filter(item => item.coupon).map(item => item.coupon)
if (coupons && coupons.length > 0) {
@ -195,7 +194,6 @@ export default {
deep: true
},
inListData(val) {
// console.log(val)
if (val && val.length > 0) {
val.forEach(item => {
item = {
@ -204,20 +202,10 @@ export default {
totalPrice: item.itemMoney,
}
})
// console.log(val)
// this.list = val.map(item => {
// return {
// ...item,
// count: item?.itemCount,
// }
// })
}
}
},
computed: {
// DICT_TYPE() {
// return DICT_TYPE
// },
getLabelName() {
switch (this.itemType) {
case "project":

View File

@ -39,14 +39,31 @@
<el-table-column label="车牌号" align="center" prop="carNo" width="180"/>
<el-table-column label="车系" align="center" prop="carBrandName" width="180"/>
<el-table-column label="手机号" align="center" prop="userMobile" width="180"/>
<el-table-column label="操作" fixed="right" align="center" width="180">
<el-table-column label="操作" fixed="right" align="center" width="200">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-view" @click="handleShow(scope.row)"
>查看
</el-button>
<el-button size="mini" type="text" icon="el-icon-document-add" @click="handleGet(scope.row)">
申请领料
<el-button v-if="scope.row.ticketsWorkStatus === '01' && (userRole === 3 || userRole === 4)" size="mini" type="text" icon="el-icon-check" @click="handleTake(scope.row)">
接单
</el-button>
<el-button v-if="userRole === 2 && scope.row.ticketsWorkStatus === '01'" size="mini" type="text" icon="el-icon-check" @click="handleNotify(scope.row)">
通知施工
</el-button>
<el-dropdown @command="(command) => handleCommand(command, scope.$index, scope.row)">
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-if="!isFinish && scope.row.ticketsWorkStatus === '02'" @click="handleGet(scope.row)" size="mini" type="text" icon="el-icon-document-add"
>申请领料
</el-dropdown-item>
<el-dropdown-item v-if="isFinish" @click="handleBack(scope.row)" size="mini" type="text" icon="el-icon-document-delete"
>申请退料
</el-dropdown-item>
<el-dropdown-item v-if="userRole !== 4" command="handleReTake" size="mini" type="text" icon="el-icon-refresh"
>重新指派
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
@ -55,19 +72,26 @@
@pagination="listTickets"
/>
<TicketsShow ref="ticketsShow"/>
<UpdateRepair ref="updateRepair" @success="listTickets"/>
</div>
</template>
<script>
import {getPageType} from "@/api/repair/tickets/Tickets";
import {getPageType, updateTake} from "@/api/repair/tickets/Tickets";
import TicketsShow from "@/views/repair/tickets/Components/TicketsShow.vue";
import UpdateRepair from "@/views/repair/tickets/form/UpdateRepair.vue";
export default {
name: "TicketManagerItem",
components: {TicketsShow},
components: {UpdateRepair, TicketsShow},
props: {
isFinish: {
type: Boolean,
},
userRole: {
type: Number,
default: -1,
required: true
}
},
data() {
@ -97,23 +121,65 @@ export default {
this.list = res.data.records
this.total = res.data.total
}
}finally {
} finally {
this.loading = false
}
},
//
handleQuery() {
this.queryParams.pageNo = 1
this.listTickets()
},
//
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
//
handleShow(row) {
this.$refs.ticketsShow.open(row)
},
handleGet(row){
//
handleGet(row) {
},
//
async handleTake(row) {
try {
this.loading = true
await this.$modal.confirm("确认接单吗?")
await updateTake(row.id)
this.$modal.msgSuccess("接单成功")
await this.listTickets()
}finally {
this.loading = false
}
},
// 退
handleBack(row){
},
//
handleReTake(row){
row = {
...row,
isLeads: true
}
this.$refs.updateRepair.open(row)
},
//
handleNotify(row){
this.$refs.updateRepair.open(row)
},
//
handleCommand(command, index, row){
switch (command){
case 'handleReTake':
this.handleReTake(row)
break
default:
break
}
}
}
}

View File

@ -66,7 +66,7 @@
</el-table-column>
<el-table-column label="状态" align="center" prop="ticketsWorkStatus" width="180">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.REPAIR_TICKETS_STATUS" v-model="scope.row.ticketsWorkStatus"/>
<dict-tag :type="DICT_TYPE.REPAIR_TICKETS_WORK_STATUS" v-model="scope.row.ticketsWorkStatus"/>
</template>
</el-table-column>
<el-table-column label="客户名称" align="center" prop="userName" width="180"/>

View File

@ -26,7 +26,7 @@
<template slot="label">
状态
</template>
<dict-tag :type="DICT_TYPE.REPAIR_TICKETS_STATUS" v-model="info.ticketsWorkStatus"/>
<dict-tag :type="DICT_TYPE.REPAIR_TICKETS_WORK_STATUS" v-model="info.ticketsWorkStatus"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">

View File

@ -2,10 +2,10 @@
<div class="app-container">
<el-tabs v-model="activeTab">
<el-tab-pane label="待完成工单" name="unFinish">
<TicketManagerItem :is-finish="false"/>
<TicketManagerItem :is-finish="false" :user-role="userRole"/>
</el-tab-pane>
<el-tab-pane label="已完成工单" name="finish">
<TicketManagerItem :is-finish="true"/>
<TicketManagerItem :is-finish="true" :user-role="userRole"/>
</el-tab-pane>
<el-tab-pane label="领料申请单" name="getApply">
</el-tab-pane>
@ -17,13 +17,25 @@
<script>
import TicketManagerItem from "@/views/repair/tickets/Components/TicketManagerItem.vue";
import {getUserRole} from "@/api/repair/tickets/Tickets";
export default {
name: "TicketManager",
components: {TicketManagerItem},
data(){
return{
activeTab: 'unFinish'
data() {
return {
activeTab: 'unFinish',
userRole: -1
}
},
created() {
this.judgeUserRole()
},
methods: {
//
async judgeUserRole(){
const res = await getUserRole()
this.userRole = res.data
}
}
}

View File

@ -0,0 +1,233 @@
<template>
<div class="app-container">
<el-dialog title="通知施工" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
<el-card class="box-card">
<!-- 卡片头 -->
<div slot="header" class="clearfix">
<i class="el-icon-plus"/>
<span>工单信息</span>
</div>
<!-- 卡片内容 -->
<div>
<el-descriptions class="margin-top" :column="4" :size="'medium'" border style="margin-bottom: 1rem">
<el-descriptions-item>
<template slot="label">
订单编号
</template>
{{ info.ticketNo }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
维修类别
</template>
<dict-tag :type="DICT_TYPE.REPAIR_TYPE" v-model="info.repairType"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
状态
</template>
<dict-tag :type="DICT_TYPE.REPAIR_TICKETS_WORK_STATUS" v-model="info.ticketsWorkStatus"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
客户名称
</template>
{{ info.userName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
车牌号
</template>
{{ info.carNo }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
车系
</template>
{{ info.carBrandName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
手机号
</template>
{{ info.userMobile }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
创建时间
</template>
{{ parseTime(info.createTime, '{y}-{m}-{d}') }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
预计完工
</template>
{{ parseTime(info.outTime, '{y}-{m}-{d}') }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
合计金额
</template>
{{ info.totalPrice }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
参考成本
</template>
{{ info.cost }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
参考毛利
</template>
{{ info.profit }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
领料状态
</template>
<dict-tag :type="DICT_TYPE.REPAIR_PART_STATUS" v-model="info.partStatus"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
服务顾问
</template>
{{ info.adviserName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
所属门店
</template>
{{ info.corpId }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
工单状态
</template>
<dict-tag :type="DICT_TYPE.REPAIR_TICKETS_STATUS" v-model="info.ticketsStatus"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
备注
</template>
{{ info.remark }}
</el-descriptions-item>
</el-descriptions>
</div>
</el-card>
<el-card class="box-card">
<!-- 卡片头 -->
<div slot="header" class="clearfix">
<i class="el-icon-plus"/>
<span>员工列表</span>
</div>
<!-- 卡片内容 -->
<div>
<el-table v-loading="loading" :data="workerList" :stripe="true" :show-overflow-tooltip="true"
@row-click="handleClick">
<el-table-column width="55">
<template slot-scope="scope">
<el-radio
class="radio"
:label="scope.row"
v-model="selectedRows"
>&emsp;&emsp;&emsp;
</el-radio>
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="userName"/>
<el-table-column label="工种" align="center" prop="workType">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.REPAIR_WORK_TYPE" :value="scope.row.workType"/>
</template>
</el-table-column>
<el-table-column label="角色" align="center" prop="isLeads">
<template v-slot="scope">
<el-tag v-if="scope.row.isLeads == '1'" type="success">班组长</el-tag>
<el-tag v-if="scope.row.isLeads == '0'" type="warning">维修工</el-tag>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {listByTicketId, listByLeads} from "@/api/repair/repairworker";
import {updateRepair} from "@/api/repair/tickets/Tickets";
export default {
name: "UpdateRepair",
data() {
return {
dialogVisible: false,
formLoading: false,
info: {},
workerList: [],
loading: false,
selectedRows: null,
formData: {
id: null,
nowRepairId: null,
nowRepairName: null,
}
}
},
methods: {
async open(row) {
this.dialogVisible = true
if (row) {
try {
this.info = row
this.loading = true
console.log(row.isLeads)
if (!row.isLeads) {
const res = await listByTicketId(row.id)
this.workerList = res.data
} else {
const res = await listByLeads()
this.workerList = res.data
}
} finally {
this.loading = false
}
}
},
async submitForm() {
try {
if (!this.selectedRows) {
this.$modal.msgError("没有指派员工")
return
}
this.initFormData()
await updateRepair(this.formData)
this.$modal.msgSuccess("指派成功")
this.dialogVisible = false
this.$emit("success")
} catch {
}
},
initFormData() {
this.formData.id = this.info.id
this.formData.nowRepairId = this.selectedRows.userId
this.formData.nowRepairName = this.selectedRows.userName
},
handleClick(row) {
this.selectedRows = row
}
}
}
</script>
<style scoped lang="scss">
.box-card {
margin-bottom: 10px;
}
</style>